diff options
author | Josh Brown <josh9051@gmail.com> | 2021-12-20 05:44:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-20 10:44:13 +0000 |
commit | e38144177199721c3bf3f5e2cde403c2ce29c67e (patch) | |
tree | 468b1cf281b5c0a11f7e3e8d34ef1f705832fa32 /srp/src/tools.rs | |
parent | a74a157d66586cf7c608ef5a712badde6325dfb8 (diff) | |
download | PAKEs-e38144177199721c3bf3f5e2cde403c2ce29c67e.tar.xz |
srp: replace custom powm with modpow (#78)
Diffstat (limited to 'srp/src/tools.rs')
-rw-r--r-- | srp/src/tools.rs | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/srp/src/tools.rs b/srp/src/tools.rs deleted file mode 100644 index 7f7da0f..0000000 --- a/srp/src/tools.rs +++ /dev/null @@ -1,19 +0,0 @@ -use num_bigint::BigUint; - -pub fn powm(base: &BigUint, exp: &BigUint, modulus: &BigUint) -> BigUint { - let zero = BigUint::from(0u32); - let one = BigUint::from(1u32); - let two = BigUint::from(2u32); - let mut exp = exp.clone(); - let mut result = one.clone(); - let mut base = base % modulus; - - while exp > zero { - if &exp % &two == one { - result = (result * &base) % modulus; - } - exp >>= 1; - base = (&base * &base) % modulus; - } - result -} |