예제 #1
0
        public byte[] HashFinal(bool isEndOfLayer)
        {
            if (!this._isInitialized)
            {
                throw new InvalidOperationException("Not initialized");
            }

            this._isInitialized = false;

            this._counter0         += (uint)this._bufferFilled;
            this._finalizationFlag0 = ulong.MaxValue;
            if (isEndOfLayer)
            {
                this._finalizationFlag1 = ulong.MaxValue;
            }

            for (int i = this._bufferFilled; i < this._buf.Length; i++)
            {
                this._buf[i] = 0;
            }

            this.Compress(this._buf, 0);

            // Output
            byte[] hash = new byte[64];
            for (int i = 0; i < 8; ++i)
            {
                Blake2BCore.UInt64ToBytes(this._h[i], hash, i << 3);
            }

            return(hash);
        }