protected override byte[] HashFinal()
        {
            if (!hashing)
            {
                hash.TransformBlock(innerPad, 0, innerPad.Length, innerPad, 0);
                hashing = true;
            }
            // Finalize the original hash
            hash.TransformFinalBlock(new byte[0], 0, 0);

            byte[] firstResult = hash.Hash;

            hash.Initialize();
            hash.TransformBlock(outerPad, 0, outerPad.Length, outerPad, 0);
            hash.TransformFinalBlock(firstResult, 0, firstResult.Length);

            Initialize();

            return(hash.Hash);
        }
Пример #2
0
 protected override byte[] HashFinal()
 {
     if (!hashing)
     {
         hashing = true;
     }
     md5.TransformFinalBlock(new byte[0], 0, 0);
     sha.TransformFinalBlock(new byte[0], 0, 0);
     byte[] array = new byte[36];
     Buffer.BlockCopy(md5.Hash, 0, array, 0, 16);
     Buffer.BlockCopy(sha.Hash, 0, array, 16, 20);
     return(array);
 }
        public byte[] Final()
        {
            block.Final();
            byte[] intermediate = algo.Hash;

            byte[] buf = KeySetup(key, 0x5C);
            algo.Initialize();
            algo.TransformBlock(buf, 0, buf.Length, buf, 0);
            algo.TransformFinalBlock(intermediate, 0, intermediate.Length);
            hash = algo.Hash;
            algo.Clear();
            // zeroize sensitive data
            Array.Clear(buf, 0, buf.Length);
            Array.Clear(intermediate, 0, intermediate.Length);
            return(hash);
        }