mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 14:18:47 +00:00
Merge pull request #3270 from edyu/master
Expose internal invmod and int_exponent_mod with more consistent naming
This commit is contained in:
@@ -2047,6 +2047,7 @@ internal_int_inverse_modulo :: proc(dest, a, b: ^Int, allocator := context.alloc
|
|||||||
|
|
||||||
return _private_inverse_modulo(dest, a, b)
|
return _private_inverse_modulo(dest, a, b)
|
||||||
}
|
}
|
||||||
|
internal_int_invmod :: internal_int_inverse_modulo
|
||||||
internal_invmod :: proc{ internal_int_inverse_modulo, }
|
internal_invmod :: proc{ internal_int_inverse_modulo, }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ internal_int_prime_is_divisible :: proc(a: ^Int, allocator := context.allocator)
|
|||||||
Computes res == G**X mod P.
|
Computes res == G**X mod P.
|
||||||
Assumes `res`, `G`, `X` and `P` to not be `nil` and for `G`, `X` and `P` to have been initialized.
|
Assumes `res`, `G`, `X` and `P` to not be `nil` and for `G`, `X` and `P` to have been initialized.
|
||||||
*/
|
*/
|
||||||
internal_int_exponent_mod :: proc(res, G, X, P: ^Int, allocator := context.allocator) -> (err: Error) {
|
internal_int_power_modulo :: proc(res, G, X, P: ^Int, allocator := context.allocator) -> (err: Error) {
|
||||||
context.allocator = allocator
|
context.allocator = allocator
|
||||||
|
|
||||||
dr: int
|
dr: int
|
||||||
@@ -112,6 +112,9 @@ internal_int_exponent_mod :: proc(res, G, X, P: ^Int, allocator := context.alloc
|
|||||||
*/
|
*/
|
||||||
return _private_int_exponent_mod(res, G, X, P, 0)
|
return _private_int_exponent_mod(res, G, X, P, 0)
|
||||||
}
|
}
|
||||||
|
internal_int_exponent_mod :: internal_int_power_modulo
|
||||||
|
internal_int_powmod :: internal_int_power_modulo
|
||||||
|
internal_powmod :: proc { internal_int_power_modulo, }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Kronecker/Legendre symbol (a|p)
|
Kronecker/Legendre symbol (a|p)
|
||||||
@@ -1411,4 +1414,4 @@ number_of_rabin_miller_trials :: proc(bit_size: int) -> (number_of_trials: int)
|
|||||||
case:
|
case:
|
||||||
return 2 /* For keysizes bigger than 10_240 use always at least 2 Rounds */
|
return 2 /* For keysizes bigger than 10_240 use always at least 2 Rounds */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user