public void Reset(IMemoable other) { Grindahl512Digest originalDigest = (Grindahl512Digest)other; Array.Copy(originalDigest._state, 0, _state, 0, _state.Length); Array.Copy(originalDigest._buffer, 0, _buffer, 0, _buffer.Length); Array.Copy(originalDigest._temp, 0, _temp, 0, _temp.Length); _bufferPos = originalDigest._bufferPos; _processedBytes = originalDigest._processedBytes; }
public static byte[] Grindahl512(byte[] bytes) { if (!Grindahl512Hashers.TryPop(out var hasher)) { hasher = new Grindahl512Digest(); } try { var result = new byte[hasher.GetDigestSize()]; hasher.BlockUpdate(bytes, 0, bytes.Length); hasher.DoFinal(result, 0); hasher.Reset(); return(result); } finally { Grindahl512Hashers.Push(hasher); } }
/** * Copy constructor. This will copy the state of the provided * message digest. */ public Grindahl512Digest(Grindahl512Digest t) { Reset(t); }