public void NoInput_CorrectOutput() { var digest = new SHA256Digest(SHA256Digest.Mode.SHA224); var result = digest.DigestBuffer(); AssertSHA224("d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", result); }
public void NoInput_CorrectOutput() { var digest = new SHA256Digest(SHA256Digest.Mode.SHA256); var result = digest.DigestBuffer(); AssertSHA256("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", result); }
public void String_CorrectOutput() { var digest = new SHA256Digest(SHA256Digest.Mode.SHA224); var buffer = Encoding.UTF8.GetBytes("The quick brown fox jumps over the lazy dog"); digest.Update(buffer); var result = digest.DigestBuffer(); AssertSHA224("730e109bd7a8a32b1cb9d9a09aa2325d2430587ddbc0c38bad911525", result); }
public void SimpleString_CorrectOutput() { var digest = new SHA256Digest(SHA256Digest.Mode.SHA224); var buffer = new byte[] { 0x24 }; digest.Update(buffer); var result = digest.DigestBuffer(); AssertSHA224("23fa1e672a6c2acdc4d7bfae713e0c9337ba057b5d5ace2685b59321", result); }
public void String_CorrectOutput() { var digest = new SHA256Digest(SHA256Digest.Mode.SHA256); var buffer = Encoding.UTF8.GetBytes("The quick brown fox jumps over the lazy dog"); digest.Update(buffer); var result = digest.DigestBuffer(); AssertSHA256("d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592", result); }
public void SimpleString_CorrectOutput() { var digest = new SHA256Digest(SHA256Digest.Mode.SHA256); var buffer = new byte[] { 0x24 }; digest.Update(buffer); var result = digest.DigestBuffer(); AssertSHA256("09fc96082d34c2dfc1295d92073b5ea1dc8ef8da95f14dfded011ffb96d3e54b", result); }
private void RunNIST(string file) { var lines = File.ReadAllLines("TestVectors/" + file); for (var i = 0; i < lines.Length; i += 4) { var digest = new SHA256Digest(SHA256Digest.Mode.SHA224); var len = int.Parse(lines[i].Substring(6)) / 8; var msg = HexConverter.FromHex(lines[i + 1].Substring(6)); var expectedHash = lines[i + 2].Substring(5); digest.Update(msg.AsSpan(0, len)); var hash = digest.DigestBuffer(); AssertSHA224(expectedHash, hash); } }
public void Clone_SeperateStateFromOriginal() { var digest = new SHA256Digest(SHA256Digest.Mode.SHA224); var buffer = Encoding.UTF8.GetBytes("The quick brown fox jumps"); digest.Update(buffer); var digest2 = digest.Clone(); buffer = Encoding.UTF8.GetBytes(" over the lazy dog"); digest2.Update(buffer); var result1 = digest.DigestBuffer(); var result2 = digest2.DigestBuffer(); AssertSHA224("51e20e8548cc6b25a948cbda204d8dd970246d31203f97e8effaf368", result1); AssertSHA224("730e109bd7a8a32b1cb9d9a09aa2325d2430587ddbc0c38bad911525", result2); }
public void Clone_SeperateStateFromOriginal() { var digest = new SHA256Digest(SHA256Digest.Mode.SHA256); var buffer = Encoding.UTF8.GetBytes("The quick brown fox jumps"); digest.Update(buffer); var digest2 = digest.Clone(); buffer = Encoding.UTF8.GetBytes(" over the lazy dog"); digest2.Update(buffer); var result1 = digest.DigestBuffer(); var result2 = digest2.DigestBuffer(); AssertSHA256("8df831769cd51e4f57808343603e97c1ea44fcab46bb595a5000b9ad1d03bd70", result1); AssertSHA256("d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592", result2); }