@@ -50,15 +50,16 @@ if len(sys.argv) < 2:
50
50
print ( "-a\t Number of addresses to generate, default none\n -i\t Address start index, default 0\n -c\t Output \" change\" addresses" )
51
51
print ( "-k\t Include pubkey or script hash" )
52
52
print ( "-e\t Use input data as entropy to create word list of given word count.\n -x\t Input is xpub/ypub, only output addresses" )
53
+ print ( "-d\t Use input data directly to create word list of given word count." )
53
54
print ( "Seed words can be in quotes or not, but must follow options. Use -- to read from stdin." )
54
55
sys .exit (1 )
55
56
56
57
passphrase = ''
57
58
derivation = "m/44'/0'/0'"
58
59
wordlist = 'english.txt'
59
60
addrcfg = { 'cnt' :0 , 'start' :0 , 'chg' :0 }
60
- wordcount = 0
61
- js ,addr_only ,pkh = False ,False ,False
61
+ wordcount , orgdata = 0 , 0
62
+ js ,addr_only ,pkh , direct = False , False ,False ,False
62
63
63
64
seedargs = 1
64
65
seed_data = None
@@ -74,6 +75,8 @@ while(seedargs < len(sys.argv)):
74
75
js = True
75
76
elif opt == 'k' :
76
77
pkh = True
78
+ elif opt == 'd' :
79
+ direct = True
77
80
elif opt == 'c' :
78
81
addrcfg ['chg' ] = 1
79
82
elif opt == 'x' :
@@ -162,7 +165,8 @@ if addr_only:
162
165
163
166
else :
164
167
if wordcount in [12 ,15 ,18 ,21 ,24 ]:
165
- seed_data = hex_to_bip39 (binascii .hexlify (hashlib .sha512 (seed_data [0 ].encode ()).digest ()), wordlist , wordcount )
168
+ orgdata = seed_data [0 ]
169
+ seed_data = hex_to_bip39 (binascii .hexlify (hashlib .sha512 (seed_data [0 ].encode ()).digest ()) if not direct else seed_data [0 ]+ "00" , wordlist , wordcount )
166
170
167
171
last_word = bip39_validate (' ' .join (seed_data ), wordlist )
168
172
if seed_data [- 1 ] != last_word :
@@ -175,6 +179,8 @@ else:
175
179
out ['seedhex' ] = str (binascii .hexlify (bip32_seed ), 'ascii' )
176
180
xtype = 'p2wpkh-p2sh' if derivation .startswith ("m/49'" ) else 'standard'
177
181
out ['type' ] = 'p2pkh' if xtype == 'standard' else xtype
182
+ if orgdata != 0 :
183
+ out ['entropy' ] = orgdata
178
184
179
185
#from electrum.bitcoin import bip32_root, bip32_private_derivation
180
186
#prv,pub = bip32_root(bip32_seed, xtype)
0 commit comments