Iaik.Utils.Hash.HashProvider.Hash C# (CSharp) 메소드

Hash() 공개 메소드

Performs the hashing operation. The data is applied to the hash algorithm as they come in dataProviders.
public Hash ( ) : byte[]
리턴 byte[]
        public byte[] Hash(params HashDataProvider[] dataProviders)
        {
            _hashAlgorithm.Initialize ();

            byte[] internalBuffer = new byte[1024 * 4];

            foreach (HashDataProvider dataProvider in dataProviders) {
                int bufferLength;
                do {
                    bufferLength = dataProvider.NextBytes (internalBuffer);

                    if (bufferLength > 0)
                        _hashAlgorithm.TransformBlock (internalBuffer, 0, bufferLength, internalBuffer, 0);
                } while (bufferLength > 0);
            }

            _hashAlgorithm.TransformFinalBlock (internalBuffer, 0, 0);
            return _hashAlgorithm.Hash;
        }

Same methods

HashProvider::Hash ( byte buffer, int index ) : void

Usage Example

예제 #1
0
파일: Digest.cs 프로젝트: deveck/doTSS
        public bool CompareTo(params HashDataProvider[] hashDataProviders)
        {
            HashProvider hasher = new HashProvider (_hashAlgo);

            byte[] localHash = hasher.Hash (hashDataProviders);

            return ByteHelper.CompareByteArrays (_digest, localHash);
        }
All Usage Examples Of Iaik.Utils.Hash.HashProvider::Hash