tadd 8 bits to entropy target, to offset the constraint imposed by is_new_seed - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
DIR commit 8816d7072f2c89d9ceb35522415e42ff4cbf78fb
DIR parent 4d71707be828687b1b270f84c42dc3eb739f39d3
HTML Author: ThomasV <thomasv@gitorious>
Date: Thu, 28 Aug 2014 17:40:36 +0200
add 8 bits to entropy target, to offset the constraint imposed by is_new_seed
Diffstat:
M lib/mnemonic.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
DIR diff --git a/lib/mnemonic.py b/lib/mnemonic.py
t@@ -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
t@@ -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