public void VerifyNullArray2() { Sha1Sum sum = new Sha1Sum(); Assert.IsNotNull(sum); bool match = sum.Verify(new byte[1], (byte[])null); }
public void VerifyFromTestFile1() { Sha1Sum sum = new Sha1Sum(); Assert.IsNotNull(sum); byte[] array = File.ReadAllBytes("../../TestData/TextFile1.txt"); bool match = sum.Verify(array, File1Sum); Assert.IsTrue(match); }
public void VerifyFromTestFile1Stream() { Sha1Sum sum = new Sha1Sum(); Assert.IsNotNull(sum); FileStream file = new FileStream("../../TestData/TextFile1.txt", FileMode.Open); bool match = sum.Verify(file, File1Sum); file.Close(); Assert.IsTrue(match); }
public void VerifyFromTestFile1Fail() { Sha1Sum sum = new Sha1Sum(); Assert.IsNotNull(sum); // Create invalid checksum byte[] invalidSum = new byte[Sha1Sum.SumSize]; Array.Copy(File1Sum, invalidSum, Sha1Sum.SumSize); invalidSum[3] = 0x00; byte[] array = File.ReadAllBytes("../../TestData/TextFile1.txt"); bool match = sum.Verify(array, invalidSum); Assert.IsFalse(match); }
public void VerifyFromTestFile1StreamFail() { Sha1Sum sum = new Sha1Sum(); Assert.IsNotNull(sum); // Create invalid checksum byte[] invalidSum = new byte[Sha1Sum.SumSize]; Array.Copy(File1Sum, invalidSum, Sha1Sum.SumSize); invalidSum[3] = 0x00; FileStream file = new FileStream("../../TestData/TextFile1.txt", FileMode.Open); bool match = sum.Verify(file, invalidSum); file.Close(); Assert.IsFalse(match); }