1010except ImportError :
1111 from pybitmessage .pyelliptic import arithmetic
1212
13-
14- # These keys are from addresses test script
15- sample_pubsigningkey = (
16- b'044a367f049ec16cb6b6118eb734a9962d10b8db59c890cd08f210c43ff08bdf09d'
17- b'16f502ca26cd0713f38988a1237f1fc8fa07b15653c996dc4013af6d15505ce' )
18- sample_pubencryptionkey = (
19- b'044597d59177fc1d89555d38915f581b5ff2286b39d022ca0283d2bdd5c36be5d3c'
20- b'e7b9b97792327851a562752e4b79475d1f51f5a71352482b241227f45ed36a9' )
21- sample_privsigningkey = \
22- b'93d0b61371a54b53df143b954035d612f8efa8a3ed1cf842c2186bfd8f876665'
23- sample_privencryptionkey = \
24- b'4b0b73a54e19b059dc274ab69df095fe699f43b17397bca26fdf40f4d7400a3a'
25-
26- # [chan] bitmessage
27- sample_wif_privsigningkey = \
28- b'a2e8b841a531c1c558ee0680c396789c7a2ea3ac4795ae3f000caf9fe367d144'
29- sample_wif_privencryptionkey = \
30- b'114ec0e2dca24a826a0eed064b0405b0ac148abc3b1d52729697f4d7b873fdc6'
31-
32- sample_factor = \
33- 66858749573256452658262553961707680376751171096153613379801854825275240965733
34- # G * sample_factor
35- sample_point = (
36- 33567437183004486938355437500683826356288335339807546987348409590129959362313 ,
37- 94730058721143827257669456336351159718085716196507891067256111928318063085006
13+ from .samples import (
14+ sample_deterministic_addr3 , sample_deterministic_addr4 ,
15+ sample_daddr3_512 , sample_daddr4_512 ,
16+ sample_factor , sample_point , sample_pubsigningkey , sample_pubencryptionkey ,
17+ sample_privsigningkey , sample_privencryptionkey ,
18+ sample_privsigningkey_wif , sample_privencryptionkey_wif ,
19+ sample_wif_privsigningkey , sample_wif_privencryptionkey
3820)
3921
4022
@@ -50,33 +32,29 @@ def test_base58(self):
5032 """Test encoding/decoding base58 using arithmetic functions"""
5133 self .assertEqual (
5234 arithmetic .decode (arithmetic .changebase (
53- b'2cWzSnwjJ7yRP3nLEWUV5LisTZyREWSzUK' , 58 , 256 ), 256 ),
54- 25152821841976547050350277460563089811513157529113201589004 )
35+ sample_deterministic_addr4 , 58 , 256 ), 256 ), sample_daddr4_512 )
5536 self .assertEqual (
5637 arithmetic .decode (arithmetic .changebase (
57- b'2DBPTgeSawWYZceFD69AbDT5q4iUWtj1ZN' , 58 , 256 ), 256 ),
58- 18875720106589866286514488037355423395410802084648916523381 )
38+ sample_deterministic_addr3 , 58 , 256 ), 256 ), sample_daddr3_512 )
5939 self .assertEqual (
60- arithmetic .changebase (arithmetic . encode (
61- 25152821841976547050350277460563089811513157529113201589004 ,
62- 256 ), 256 , 58 ), b'2cWzSnwjJ7yRP3nLEWUV5LisTZyREWSzUK' )
40+ arithmetic .changebase (
41+ arithmetic . encode ( sample_daddr4_512 , 256 ), 256 , 58 ) ,
42+ sample_deterministic_addr4 )
6343 self .assertEqual (
64- arithmetic .changebase (arithmetic . encode (
65- 18875720106589866286514488037355423395410802084648916523381 ,
66- 256 ), 256 , 58 ), b'2DBPTgeSawWYZceFD69AbDT5q4iUWtj1ZN' )
44+ arithmetic .changebase (
45+ arithmetic . encode ( sample_daddr3_512 , 256 ), 256 , 58 ) ,
46+ sample_deterministic_addr3 )
6747
6848 def test_wif (self ):
6949 """Decode WIFs of [chan] bitmessage and check the keys"""
7050 self .assertEqual (
7151 sample_wif_privsigningkey ,
7252 arithmetic .changebase (arithmetic .changebase (
73- b'5K42shDERM5g7Kbi3JT5vsAWpXMqRhWZpX835M2pdSoqQQpJMYm' , 58 , 256
74- )[1 :- 4 ], 256 , 16 ))
53+ sample_privsigningkey_wif , 58 , 256 )[1 :- 4 ], 256 , 16 ))
7554 self .assertEqual (
7655 sample_wif_privencryptionkey ,
7756 arithmetic .changebase (arithmetic .changebase (
78- b'5HwugVWm31gnxtoYcvcK7oywH2ezYTh6Y4tzRxsndAeMi6NHqpA' , 58 , 256
79- )[1 :- 4 ], 256 , 16 ))
57+ sample_privencryptionkey_wif , 58 , 256 )[1 :- 4 ], 256 , 16 ))
8058
8159 def test_decode (self ):
8260 """Decode sample privsigningkey from hex to int and compare to factor"""
0 commit comments