From ac8e792c5842d5aae20bd97b1f51cbe8066e9276 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Sat, 15 Aug 2015 09:52:27 +0300 Subject: [PATCH] test_ripemd: add simple test case for ripemd module --- lib/tests/test_ripemd.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lib/tests/test_ripemd.py diff --git a/lib/tests/test_ripemd.py b/lib/tests/test_ripemd.py new file mode 100644 index 00000000..cc832608 --- /dev/null +++ b/lib/tests/test_ripemd.py @@ -0,0 +1,16 @@ +import unittest +import random +import hashlib + +from lib import ripemd + +class Test_RIPEMD160(unittest.TestCase): + """ Test pure Python implementation against standard library. """ + + def test_ripemd(self): + r = random.Random(0) + for i in range(128): + blob = bytearray([r.randrange(0, 256) for j in range(1024)]) + h = hashlib.new('ripemd160') + h.update(blob) + self.assertEqual(h.hexdigest(), ripemd.new(blob).hexdigest())