GetPadded() приватный статический Метод

Pads a byte[] to the specified length, with zeroes at the start of the buffer.
private static GetPadded ( BigInteger n, int length ) : byte[]
n Org.BouncyCastle.Math.BigInteger
length int
Результат byte[]
Пример #1
0
        public static BigInteger CalculateKey(IDigest digest, BigInteger N, BigInteger S)
        {
            int length = (N.BitLength + 7) / 8;

            byte[] padded = Srp6Utilities.GetPadded(S, length);
            digest.BlockUpdate(padded, 0, padded.Length);
            byte[] array = new byte[digest.GetDigestSize()];
            digest.DoFinal(array, 0);
            return(new BigInteger(1, array));
        }
Пример #2
0
        private static BigInteger HashPaddedPair(IDigest digest, BigInteger N, BigInteger n1, BigInteger n2)
        {
            int length = (N.BitLength + 7) / 8;

            byte[] padded  = Srp6Utilities.GetPadded(n1, length);
            byte[] padded2 = Srp6Utilities.GetPadded(n2, length);
            digest.BlockUpdate(padded, 0, padded.Length);
            digest.BlockUpdate(padded2, 0, padded2.Length);
            byte[] array = new byte[digest.GetDigestSize()];
            digest.DoFinal(array, 0);
            return(new BigInteger(1, array));
        }