public void VerifyString_CHANGED() { IHashBox hashBox = new HashBox(); var result = hashBox.Compute(TEST_STRING); Assert.IsFalse(result.Verify(TEST_STRING_CHANGED)); }
public void VerifyString() { IHashBox hashBox = new HashBox(); var result = hashBox.Compute(TEST_STRING); Assert.IsTrue(result.Verify(TEST_STRING)); }
public void VerifyBytes() { IHashBox hashBox = new HashBox(); var bytes = Encoding.Default.GetBytes(TEST_STRING); var result = hashBox.Compute(bytes); Assert.IsTrue(result.Verify(bytes)); }
public void VerifyString_CHANGED_Keyed() { IHashBox hashBox = new HashBox(new Key(TEST_KEY)); var result = hashBox.Compute(TEST_STRING_CHANGED); var tmp = new HashedTag(TEST_HASHED_KEY); Assert.IsFalse(result.Verify(tmp)); }
public void VerifyBytes_CHANGED_Keyed() { IHashBox hashBox = new HashBox(new Key(TEST_KEY)); var bytes = Encoding.Default.GetBytes(TEST_STRING_CHANGED); var result = hashBox.Compute(bytes); var tmp = new HashedTag(TEST_HASHED_KEY); Assert.IsFalse(result.Verify(tmp)); }
public void VerifyString_Keyed() { IHashBox hashBox = new HashBox(new Key(TEST_KEY)); var result = hashBox.Compute(TEST_STRING); var hashed = string.Join(", ", result.HashBytes); var tmp = new HashedTag(TEST_HASHED_KEY); Assert.IsTrue(result.Verify(tmp)); }
public void VerifyNullParamters() { HashBox hashBox = new HashBox(); string strNull = null; Assert.ThrowsException <ArgumentNullException>(() => hashBox.Compute(strNull)); strNull = ""; Assert.ThrowsException <ArgumentNullException>(() => hashBox.Compute(strNull)); byte[] bNull = null; Assert.ThrowsException <ArgumentNullException>(() => hashBox.Compute(bNull)); bNull = new byte[0]; Assert.ThrowsException <ArgumentException>(() => hashBox.Compute(bNull)); Key kNull = null; Assert.ThrowsException <ArgumentNullException>(() => new HashBox(kNull)); }
private void NewHashBoxAndIndexList(TElement value, TElement key) { hashBox = new HashBox(value, value.GetHashCode(), key); indexList = value.GetHashCode() / maxUIntDivider; }