Example #1
0
        protected override void Compress(IBlakeState hashState, byte[] buffer, UInt64 bitCount)
        {
            var state = (Blake512State)hashState;

            state.B = Split(buffer);
            Compress(state.H, state.B, state.S, new UInt64[] { bitCount, 0x0 });
        }
Example #2
0
        protected override void Compress(IBlakeState hashState, byte[] buffer, UInt64 bitCount)
        {
            var state = (Blake256State)hashState;

            state.B = Split(buffer);
            state.C = SplitCounter(bitCount);
            Compress(state.H, state.B, state.S, state.C);
        }
Example #3
0
        protected override byte[] FinalHash(IBlakeState hashState)
        {
            var state  = (Blake512State)hashState;
            var result = Join(state.H);

            if (this._bitLen == 384)
            {
                Array.Resize(ref result, 48);
            }
            return(result);
        }
Example #4
0
        protected override void InitState(out IBlakeState hashState)
        {
            var result = new Blake512State()
            {
                B = new UInt64[16],
                S = new UInt64[4] {
                    0, 0, 0, 0
                },
                H = new UInt64[8]
            };

            if (this._bitLen == 384)
            {
                Array.Copy(_init384, result.H, 8);
            }
            else
            {
                Array.Copy(_init512, result.H, 8);
            }
            hashState = result;
        }
Example #5
0
        protected override void InitState(out IBlakeState hashState)
        {
            var result = new Blake256State()
            {
                B = new UInt32[16],
                S = new UInt32[4] {
                    0, 0, 0, 0
                },
                H = new UInt32[8]
            };

            if (this._bitLen == 224)
            {
                Array.Copy(_init224, result.H, 8);
            }
            else
            {
                Array.Copy(_init256, result.H, 8);
            }
            hashState = result;
        }
Example #6
0
 /// <summary>
 /// Process final state to hash format
 /// </summary>
 /// <param name="hashState">Final hash state</param>
 /// <returns>Hash computed</returns>
 protected abstract byte[] FinalHash(IBlakeState hashState);
Example #7
0
 /// <summary>
 /// Call hash Compress function with partial data
 /// </summary>
 /// <param name="hashState">Current hash state</param>
 /// <param name="buffer">New buffer to compress</param>
 /// <param name="bitCount">Current bit count</param>
 protected abstract void Compress(IBlakeState hashState, byte[] buffer, UInt64 bitCount);
Example #8
0
 /// <summary>
 /// Initialize instance for hash computing
 /// </summary>
 /// <param name="hashState">Hash State initialized</param>
 protected abstract void InitState(out IBlakeState hashState);