public void ChangeHasherGoodOrderTest() { MultiHash hasher = new MultiHash(new MD5(), new Sha1()); hasher.TransformBlock(TestVectors.s("1234567890"), 0, 10, null, 0); hasher.HashAlgorithms.Reverse(); hasher.TransformFinalBlock(new byte[1], 0, 0); }
public void ChangeHasherBadTest() { MultiHash hasher = new MultiHash(new MD5(), new Sha1()); hasher.TransformBlock(TestVectors.s("1234567890"), 0, 10, null, 0); hasher.HashAlgorithms.Add(new RipeMD128()); hasher.TransformFinalBlock(new byte[1], 0, 0); }
public void ChangeHashGoodTest() { byte[] input = TestVectors.s("1234567890"); Hmac hmac = new Hmac(new MD5()); hmac.HashAlgorithm = new Sha1(); hmac.TransformBlock(input, 0, 4, null, 0); }
public void ChangeKeyBadTest() { byte[] input = TestVectors.s("1234567890"); Hmac hmac = new Hmac(new MD5()); hmac.TransformBlock(input, 0, 4, null, 0); hmac.Key = TestVectors.s("new key!"); }
public void ConstructorDoubleTest() { byte[] key = TestVectors.s("1234567890"); Hmac hmac = new Hmac(new MD5(), key); MD5 md = new MD5(); Assert.AreEqual(md.GetType(), hmac.HashAlgorithm.GetType()); Assert.AreEqual(md.HashSize, hmac.HashAlgorithm.HashSize); CustomAssert.AreEqual(key, hmac.Key); }