Exemplo n.º 1
0
 public void FIPS186_b(string testName, SHA224 hash, byte[] input, byte[] result)
 {
     byte[] output = hash.ComputeHash(input, 0, input.Length);
     AssertEquals(testName + ".b.1", result, output);
     AssertEquals(testName + ".b.2", result, hash.Hash);
     // required or next operation will still return old hash
     hash.Initialize();
 }
Exemplo n.º 2
0
 public void FIPS186_d(string testName, SHA224 hash, byte[] input, byte[] result)
 {
     hash.TransformFinalBlock(input, 0, input.Length);
     // Note: TransformFinalBlock doesn't return HashValue !
     // AssertEquals( testName + ".d.1", result, output );
     AssertEquals(testName + ".d", result, hash.Hash);
     // required or next operation will still return old hash
     hash.Initialize();
 }
Exemplo n.º 3
0
        public void FIPS186_c(string testName, SHA224 hash, byte[] input, byte[] result)
        {
            MemoryStream ms = new MemoryStream(input);

            byte[] output = hash.ComputeHash(ms);
            AssertEquals(testName + ".c.1", result, output);
            AssertEquals(testName + ".c.2", result, hash.Hash);
            // required or next operation will still return old hash
            hash.Initialize();
        }
Exemplo n.º 4
0
 public void FIPS186_e(string testName, SHA224 hash, byte[] input, byte[] result)
 {
     byte[] copy = new byte [input.Length];
     for (int i = 0; i < input.Length - 1; i++)
     {
         hash.TransformBlock(input, i, 1, copy, i);
     }
     hash.TransformFinalBlock(input, input.Length - 1, 1);
     // Note: TransformFinalBlock doesn't return HashValue !
     // AssertEquals (testName + ".e.1", result, output);
     AssertEquals(testName + ".e", result, hash.Hash);
     // required or next operation will still return old hash
     hash.Initialize();
 }