Browse Source

add 8 bits to entropy target, to offset the constraint imposed by is_new_seed

283
ThomasV 10 years ago
parent
commit
8816d7072f
  1. 3
      lib/mnemonic.py

3
lib/mnemonic.py

@ -83,7 +83,7 @@ class Mnemonic(object):
def make_seed(self, num_bits=128, custom_entropy=1):
n = int(math.ceil(math.log(custom_entropy,2)))
# we add at least 16 bits
n_added = max(16, num_bits-n)
n_added = max(16, 8 + num_bits - n)
print_error("make_seed: adding %d bits"%n_added)
my_entropy = ecdsa.util.randrange( pow(2, n_added) )
nonce = 0
@ -97,5 +97,6 @@ class Mnemonic(object):
# this removes 8 bits of entropy
if is_new_seed(seed):
break
print_error('%d words'%len(seed.split()))
return seed

Loading…
Cancel
Save