MCPcopy Create free account
hub / github.com/petertodd/python-bitcoinlib / test_ripemd160

Method test_ripemd160

bitcoin/tests/test_ripemd160.py:7–24  ·  view source on GitHub ↗

RIPEMD-160 test vectors.

(self)

Source from the content-addressed store, hash-verified

5
6class Test_ripemd160(unittest.TestCase):
7 def test_ripemd160(self):
8 """RIPEMD-160 test vectors."""
9 # See https://homes.esat.kuleuven.be/~bosselae/ripemd160.html
10 for msg, hexout in [
11 (b"", "9c1185a5c5e9fc54612808977ee8f548b2258d31"),
12 (b"a", "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe"),
13 (b"abc", "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc"),
14 (b"message digest", "5d0689ef49d2fae572b881b123a85ffa21595f36"),
15 (b"abcdefghijklmnopqrstuvwxyz",
16 "f71c27109c692c1b56bbdceb5b9d2865b3708dbc"),
17 (b"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
18 "12a053384a9c0c88e405a06c27dcf49ada62eb2b"),
19 (b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
20 "b0e20b6e3116640286ed3a87a5713079b21f5189"),
21 (b"1234567890" * 8, "9b752e45573d4b39f4dbd3323cab82bf63326bfb"),
22 (b"a" * 1000000, "52783243c1697bdbe16d37f97f68f08325dc1528")
23 ]:
24 self.assertEqual(ripemd160(msg).hex(), hexout)

Callers

nothing calls this directly

Calls 1

ripemd160Function · 0.90

Tested by

no test coverage detected