Skip to content

Commit f9c8649

Browse files
committed
Add a test for WIF decoding using pyelliptic.arithmetic
1 parent 606c003 commit f9c8649

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/pyelliptic/tests/test_arithmetic.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
sample_privencryptionkey = \
2424
b'4b0b73a54e19b059dc274ab69df095fe699f43b17397bca26fdf40f4d7400a3a'
2525

26+
# [chan] bitmessage
27+
sample_wif_privsigningkey = \
28+
b'a2e8b841a531c1c558ee0680c396789c7a2ea3ac4795ae3f000caf9fe367d144'
29+
sample_wif_privencryptionkey = \
30+
b'114ec0e2dca24a826a0eed064b0405b0ac148abc3b1d52729697f4d7b873fdc6'
31+
2632
sample_factor = \
2733
66858749573256452658262553961707680376751171096153613379801854825275240965733
2834
# G * sample_factor
@@ -59,6 +65,19 @@ def test_base58(self):
5965
18875720106589866286514488037355423395410802084648916523381,
6066
256), 256, 58), b'2DBPTgeSawWYZceFD69AbDT5q4iUWtj1ZN')
6167

68+
def test_wif(self):
69+
"""Decode WIFs of [chan] bitmessage and check the keys"""
70+
self.assertEqual(
71+
sample_wif_privsigningkey,
72+
arithmetic.changebase(arithmetic.changebase(
73+
b'5K42shDERM5g7Kbi3JT5vsAWpXMqRhWZpX835M2pdSoqQQpJMYm', 58, 256
74+
)[1:-4], 256, 16))
75+
self.assertEqual(
76+
sample_wif_privencryptionkey,
77+
arithmetic.changebase(arithmetic.changebase(
78+
b'5HwugVWm31gnxtoYcvcK7oywH2ezYTh6Y4tzRxsndAeMi6NHqpA', 58, 256
79+
)[1:-4], 256, 16))
80+
6281
def test_decode(self):
6382
"""Decode sample privsigningkey from hex to int and compare to factor"""
6483
self.assertEqual(

0 commit comments

Comments
 (0)