// http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html
//
// Author:
-// Sebastien Pouliot (spouliot@motus.com)
+// Sebastien Pouliot (sebastien@ximian.com)
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
if ((array1 == null) && (array2 == null))
return;
if (array1 == null)
- TestCase.Fail (msg + " -> First array is NULL");
+ Assert.Fail (msg + " -> First array is NULL");
if (array2 == null)
- TestCase.Fail (msg + " -> Second array is NULL");
-
+ Assert.Fail (msg + " -> Second array is NULL");
+
bool a = (array1.Length == array2.Length);
if (a) {
for (int i = 0; i < array1.Length; i++) {
msg += " -> Expected " + BitConverter.ToString (array1, 0);
msg += " is different than " + BitConverter.ToString (array2, 0);
}
- TestCase.Assert (msg, a);
+ Assert.IsTrue (a, msg);
}
// RIPEMD160 ("") = 9c1185a5c5e9fc54612808977ee8f548b2258d31
public void RIPEMD160_d (string testName, RIPEMD160 hash, byte[] input, byte[] result)
{
- byte[] output = hash.TransformFinalBlock (input, 0, input.Length);
- AssertEquals (testName + ".d.1", input, output);
- AssertEquals (testName + ".d.2", result, hash.Hash);
+ hash.TransformFinalBlock (input, 0, input.Length);
+ AssertEquals (testName + ".d", result, hash.Hash);
// required or next operation will still return old hash
hash.Initialize ();
}
byte[] copy = new byte [input.Length];
for (int i=0; i < input.Length - 1; i++)
hash.TransformBlock (input, i, 1, copy, i);
- byte[] output = hash.TransformFinalBlock (input, input.Length - 1, 1);
- TestCase.AssertEquals (testName + ".e.1", input [input.Length - 1], output [0]);
- AssertEquals (testName + ".e.2", result, hash.Hash);
+ hash.TransformFinalBlock (input, input.Length - 1, 1);
+ AssertEquals (testName + ".e", result, hash.Hash);
// required or next operation will still return old hash
hash.Initialize ();
}
// none of those values changes for any implementation of RIPEMD160
+ [Test]
public virtual void StaticInfo ()
{
string className = hash.ToString ();
- TestCase.AssertEquals (className + ".HashSize", 160, hash.HashSize);
- TestCase.AssertEquals (className + ".InputBlockSize", 1, hash.InputBlockSize);
- TestCase.AssertEquals (className + ".OutputBlockSize", 1, hash.OutputBlockSize);
+ Assert.AreEqual (160, hash.HashSize, className + ".HashSize");
+ Assert.AreEqual (1, hash.InputBlockSize, className + ".InputBlockSize");
+ Assert.AreEqual (1, hash.OutputBlockSize, className + ".OutputBlockSize");
}
}
}