aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorEd Yu <edyu@users.noreply.github.com>2024-03-12 08:39:53 -0700
committerEd Yu <edyu@users.noreply.github.com>2024-03-12 11:01:09 -0700
commitdd74a57c442008e19c31d1805531683c8a62f7c8 (patch)
tree209d61a04588f93f589928fbab18704b6f7ec844 /core
parentd6353daf91e8cea613ceca705f482062cc1538eb (diff)
Expose internal invmod and int_exponent_mod with more consistent naming
Diffstat (limited to 'core')
-rw-r--r--core/math/big/internal.odin1
-rw-r--r--core/math/big/prime.odin7
2 files changed, 6 insertions, 2 deletions
diff --git a/core/math/big/internal.odin b/core/math/big/internal.odin
index 03623e7f2..07e1e6c03 100644
--- a/core/math/big/internal.odin
+++ b/core/math/big/internal.odin
@@ -2047,6 +2047,7 @@ internal_int_inverse_modulo :: proc(dest, a, b: ^Int, allocator := context.alloc
return _private_inverse_modulo(dest, a, b)
}
+internal_int_invmod :: internal_int_inverse_modulo
internal_invmod :: proc{ internal_int_inverse_modulo, }
/*
diff --git a/core/math/big/prime.odin b/core/math/big/prime.odin
index 110c10239..cb0b08dbb 100644
--- a/core/math/big/prime.odin
+++ b/core/math/big/prime.odin
@@ -44,7 +44,7 @@ internal_int_prime_is_divisible :: proc(a: ^Int, allocator := context.allocator)
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.
*/
-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
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)
}
+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)
@@ -1411,4 +1414,4 @@ number_of_rabin_miller_trials :: proc(bit_size: int) -> (number_of_trials: int)
case:
return 2 /* For keysizes bigger than 10_240 use always at least 2 Rounds */
}
-} \ No newline at end of file
+}