public void HasherHashFileBlockFromByteArrayCorrectlyHashesInput2() { ArchivialLibrary.Crypto.Hasher h = new ArchivialLibrary.Crypto.Hasher(new MockLogger()); var result = h.HashFileBlockFromByteArray( HashAlgorithmName.SHA256, LargeByteStreamConstants.LargeByteStream); var expected = new byte[] { 243, 10, 203, 238, 4, 236, 188, 44, 192, 33, 121, 88, 216, 28, 69, 38, 148, 10, 50, 148, 149, 213, 98, 172, 50, 11, 162, 156, 0, 118, 246, 92 }; Assert.IsTrue(h.CheckTwoByteHashesAreTheSame(result, expected)); }
public void HasherHashFileBlockFromByteArrayCorrectlyHashesInput1() { ArchivialLibrary.Crypto.Hasher h = new ArchivialLibrary.Crypto.Hasher(new MockLogger()); var result = h.HashFileBlockFromByteArray( HashAlgorithmName.SHA1, new byte[] { 123, 126, 219, 146, 255, 226, 17, 43, 110, 18, 215, 180, 113, 204, 233, 139, 70, 123, 173, 184, 10, 15, 97, 130, 74, 35, 247, 6, 175, 237, 224, 213, 148, 5, 56, 227, 19, 95, 192, 34, 202, 132, 25, 83, 238, 245, 36, 161, 175, 152, 72, 57, 253, 209, 189, 38, 190, 171, 12, 164, 38, 66, 1, 226 }); var expected = new byte[] { 101, 135, 62, 112, 4, 11, 126, 120, 77, 230, 134, 32, 75, 23, 92, 51, 210, 30, 32, 69 }; Assert.IsTrue(h.CheckTwoByteHashesAreTheSame(result, expected)); }
public void HasherHashFileBlockFromByteArrayThrowsOnBadInput2() { ArchivialLibrary.Crypto.Hasher h = new ArchivialLibrary.Crypto.Hasher(new MockLogger()); h.HashFileBlockFromByteArray(HashAlgorithmName.SHA256, new byte[0]); }