Esempio n. 1
0
        protected override byte[] HashFinal()
        {
            if (_disposed)
            {
                throw new ObjectDisposedException("HMAC");
            }
            State = 0;

            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);
            byte[] hash = _algo.Hash;
            _algo.Initialize();
            // zeroize sensitive data
            Array.Clear(buf, 0, buf.Length);
            Array.Clear(intermediate, 0, intermediate.Length);
            return(hash);
        }