Org.BouncyCastle.Crypto.Agreement.Srp.Srp6Utilities.CalculateX C# (CSharp) Method

CalculateX() public static method

public static CalculateX ( IDigest digest, BigInteger N, byte salt, byte identity, byte password ) : BigInteger
digest IDigest
N Org.BouncyCastle.Math.BigInteger
salt byte
identity byte
password byte
return Org.BouncyCastle.Math.BigInteger
        public static BigInteger CalculateX(IDigest digest, BigInteger N, byte[] salt, byte[] identity, byte[] password)
        {
            byte[] output = new byte[digest.GetDigestSize()];

            digest.BlockUpdate(identity, 0, identity.Length);
            digest.Update((byte)':');
            digest.BlockUpdate(password, 0, password.Length);
            digest.DoFinal(output, 0);

            digest.BlockUpdate(salt, 0, salt.Length);
            digest.BlockUpdate(output, 0, output.Length);
            digest.DoFinal(output, 0);

            return new BigInteger(1, output).Mod(N);
        }

Usage Example

Exemplo n.º 1
0
 public virtual BigInteger GenerateClientCredentials(byte[] salt, byte[] identity, byte[] password)
 {
     x     = Srp6Utilities.CalculateX(digest, N, salt, identity, password);
     privA = SelectPrivateValue();
     pubA  = g.ModPow(privA, N);
     return(pubA);
 }
All Usage Examples Of Org.BouncyCastle.Crypto.Agreement.Srp.Srp6Utilities::CalculateX