|
@@ -149,3 +149,28 @@ class unit_tests:
|
|
|
vmsg('')
|
|
|
|
|
|
return True
|
|
|
+
|
|
|
+ def genseed(self,name,ut):
|
|
|
+
|
|
|
+ vmsg('')
|
|
|
+ qmsg(blue('Testing seed generation with password'))
|
|
|
+ fn = 'test/ref/98831F3A.bip39'
|
|
|
+
|
|
|
+ vmsg(f'Seed source: {purple(fn)}')
|
|
|
+ vmsg('KDF: PBKDF2-SHA512, 2048 rounds')
|
|
|
+ with open(fn) as fh:
|
|
|
+ mnemonic = fh.read().strip()
|
|
|
+
|
|
|
+ seed_hex = bip39().generate_seed(mnemonic.split()).hex()
|
|
|
+ vmsg(f' Password: {orange("(null)")}\n {seed_hex}')
|
|
|
+ assert seed_hex == '3c30b98d3d9a713cf5a7a42f5dd27b3bf7f4d792d2b9225f6f519a0da978e13c6f36989ef2123b12a96d6ad5a443a95d61022ffaa9fbce8f946da7b67f75d339'
|
|
|
+
|
|
|
+ passwd = 'passw0rd'
|
|
|
+ seed_hex = bip39().generate_seed(mnemonic.split(),passwd).hex()
|
|
|
+ vmsg(f' Password: {orange(passwd)}\n {seed_hex}')
|
|
|
+ assert seed_hex == '7eb773bf60f1a5071f96736b6ddbe5c544a7b7740182a80493e29577e58b7cde011d4e38d26f65dab6c9fdebe5594e523447a1427ffd60746e6d04b4daa42eb1'
|
|
|
+
|
|
|
+ qmsg('OK')
|
|
|
+ vmsg('')
|
|
|
+
|
|
|
+ return True
|