Beispiel #1
0
        public void Hash64_InvalidKeyLength_Throws(int keyLength)
        {
            var invalidKey = new byte[keyLength];
            var buffer     = new byte[0];

            Assert.Throws <ArgumentException>(() => SipHash24.Hash64(buffer, invalidKey));
        }
Beispiel #2
0
 public void Hash64_Stream_InvalidKeyLength_Throws()
 {
     using (var stream = new MemoryStream(new byte[0]))
     {
         Assert.Throws <ArgumentException>(() => SipHash24.Hash64(stream, new byte[15]));
     }
 }
Beispiel #3
0
 public void Hash64_Binary_TestVectors()
 {
     for (int i = 0; i < vectors.Length; ++i)
     {
         var buffer         = getBuffer(i);
         var result         = SipHash24.Hash64(buffer, key);
         var expectedResult = vectors[i];
         Debug.WriteLine("testing iteration #" + i);
         Assert.AreEqual(expectedResult, result);
     }
 }
Beispiel #4
0
 public void Hash64_Stream_TestVectors()
 {
     for (int i = 0; i < vectors.Length; ++i)
     {
         var buffer = getBuffer(i);
         using var stream = new MemoryStream(buffer);
         var result         = SipHash24.Hash64(stream, key);
         var expectedResult = vectors[i];
         Debug.WriteLine("testing iteration #" + i);
         Assert.AreEqual(expectedResult, result);
     }
 }
Beispiel #5
0
 public void Hash64_StreamBigEndian_Throws()
 {
     Assert.Throws <NotSupportedException>(() => SipHash24.Hash64(new MemoryStream(new byte[0]), new byte[16]));
 }
Beispiel #6
0
 public void Hash64_BinaryBigEndian_Throws()
 {
     Assert.Throws <NotSupportedException>(() => SipHash24.Hash64(new byte[0], new byte[16]));
 }
Beispiel #7
0
 public void Hash64_BinaryBigEndian_Throws()
 {
     Bits.IsBigEndian = true;
     Assert.Throws <NotSupportedException>(() => SipHash24.Hash64(new byte[0], new byte[16]));
     Bits.IsBigEndian = false;
 }