[package]
name = "srp"
-version = "0.4.1"
+version = "0.4.2"
edition = "2018"
authors = ["RustCrypto Developers"]
license = "MIT OR Apache-2.0"
[dependencies]
num-bigint = "0.2"
-num-traits = "0.2"
generic-array = "0.12"
digest = "0.8"
lazy_static = "1.2"
use digest::Digest;
use generic_array::GenericArray;
use num_bigint::BigUint;
-use num_traits::Zero;
use crate::tools::powm;
use crate::types::{SrpAuthError, SrpGroup};
let b_pub = BigUint::from_bytes_be(b_pub);
// Safeguard against malicious B
- if &b_pub % &self.params.n == BigUint::zero() {
+ if &b_pub % &self.params.n == BigUint::default() {
return Err(SrpAuthError {
description: "Malicious b_pub value",
});
use digest::Digest;
use generic_array::GenericArray;
use num_bigint::BigUint;
-use num_traits::Zero;
use crate::tools::powm;
use crate::types::{SrpAuthError, SrpGroup};
) -> Result<Self, SrpAuthError> {
let a_pub = BigUint::from_bytes_be(a_pub);
// Safeguard against malicious A
- if &a_pub % ¶ms.n == BigUint::zero() {
+ if &a_pub % ¶ms.n == BigUint::default() {
return Err(SrpAuthError {
description: "Malicious a_pub value",
});
use num_bigint::BigUint;
pub fn powm(base: &BigUint, exp: &BigUint, modulus: &BigUint) -> BigUint {
- let zero = BigUint::new(vec![0]);
- let one = BigUint::new(vec![1]);
- let two = BigUint::new(vec![2]);
+ 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;