public void GetHash(Span <byte> output) { ProcessBlock(); sha.TransformFinalBlock(Array.Empty <byte>(), 0, 0); var hash1 = sha.Hash; hash1.AsSpan().CopyTo(output); }
public void FIPS186_d(string testName, SHA256 hash, byte[] input, byte[] result) { byte[] output = hash.TransformFinalBlock (input, 0, input.Length); // LAMESPEC or FIXME: TransformFinalBlock doesn't return HashValue ! // AssertEquals( testName + ".d.1", result, output ); Assert.IsNotNull (output, testName + ".d.1"); Assert.AreEqual (result, hash.Hash, testName + ".d.2"); // required or next operation will still return old hash hash.Initialize (); }
protected override byte[] HashFinal() { if (_impl != null) { _impl.TransformFinalBlock(Array.Empty <byte>(), 0, 0); return(_impl.Hash); } return(_EndHash()); }
public void FIPS186_e(string testName, SHA256 hash, byte[] input, byte[] result) { byte[] copy = new byte [input.Length]; for (int i=0; i < input.Length - 1; i++) hash.TransformBlock (input, i, 1, copy, i); byte[] output = hash.TransformFinalBlock (input, input.Length - 1, 1); // LAMESPEC or FIXME: TransformFinalBlock doesn't return HashValue ! // AssertEquals (testName + ".e.1", result, output); Assert.IsNotNull (output, testName + ".e.1"); Assert.AreEqual (result, hash.Hash, testName + ".e.2"); // required or next operation will still return old hash hash.Initialize (); }