System.Security.Cryptography.HMACSHA1.Initialize C# (CSharp) Method

Initialize() public method

public Initialize ( ) : void
return void
        public override void Initialize()
        {
            // Nothing to do here. We expect HashAlgorithm to invoke HashFinal() and Initialize() as a pair. This reflects the
            // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation.
            return;
        }

Usage Example

Beispiel #1
0
        // This function is defined as follow :
        // Func (S, i) = HMAC(S || i) | HMAC2(S || i) | ... | HMAC(iterations) (S || i)
        // where i is the block number.
        private byte[] Func()
        {
            byte[] INT_block = Utils.Int(m_block);

            m_hmacsha1.TransformBlock(m_salt, 0, m_salt.Length, null, 0);
            m_hmacsha1.TransformBlock(INT_block, 0, INT_block.Length, null, 0);
            m_hmacsha1.TransformFinalBlock(EmptyArray <Byte> .Value, 0, 0);
            byte[] temp = m_hmacsha1.HashValue;
            m_hmacsha1.Initialize();

            byte[] ret = temp;
            for (int i = 2; i <= m_iterations; i++)
            {
                m_hmacsha1.TransformBlock(temp, 0, temp.Length, null, 0);
                m_hmacsha1.TransformFinalBlock(EmptyArray <Byte> .Value, 0, 0);
                temp = m_hmacsha1.HashValue;
                for (int j = 0; j < BlockSize; j++)
                {
                    ret[j] ^= temp[j];
                }
                m_hmacsha1.Initialize();
            }

            // increment the block count.
            m_block++;
            return(ret);
        }
All Usage Examples Of System.Security.Cryptography.HMACSHA1::Initialize