public void ComputeVerifier() { var I = SrpHash.CreateBigInteger(IdentityHash.ToHexString(), 16); var ii = I.ToUnsignedByteArray(); Array.Reverse(ii); byte[] x = SrpHash.Concatenate(Salt.ToUnsignedByteArray(), ii).HashEncode(); Array.Reverse(x); SaltedIdentityHash = x.ToHexString().CreateBigInteger(16); Verifier = Generator.ModPow(SaltedIdentityHash, Modulus); }
/// <summary> /// 构建SRP6 /// </summary> /// <param name="identityhash"></param> /// <param name="modulus"></param> /// <param name="generator"></param> /// <param name="saltSize"></param> /// <param name="salt"></param> public Srp(byte[] identityhash, string modulus, string generator, int saltSize, string salt = "") : this(identityhash, modulus, generator) { if (string.IsNullOrWhiteSpace(salt)) { Salt = SrpHash.CreateBigInteger(256, new Random()); } else { Salt = salt.CreateBigInteger(16); } ComputeVerifier(); }