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 }); }
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); }
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); }
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; }
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; }
/// <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);
/// <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);
/// <summary> /// Initialize instance for hash computing /// </summary> /// <param name="hashState">Hash State initialized</param> protected abstract void InitState(out IBlakeState hashState);