commit 5da3cab24b2a9b93e92f2febf0cae43d7287763c
parent bd717897e0cc53a3888288349dd15a19252f4994
Author: thomasv <thomasv@gitorious>
Date: Sun, 24 Feb 2013 10:16:14 +0100
move seed generation function to bitcoin.py
Diffstat:
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/bitcoin.py b/lib/bitcoin.py
@@ -348,6 +348,10 @@ class EC_KEY(object):
###################################### BIP32 ##############################
+random_seed = lambda n: "%032x"%ecdsa.util.randrange( pow(2,n) )
+
+
+
def bip32_init(seed):
import hmac
diff --git a/lib/wallet.py b/lib/wallet.py
@@ -27,11 +27,9 @@ import ast
import threading
import random
import aes
-import ecdsa
import Queue
import time
-from ecdsa.util import string_to_number, number_to_string
from util import print_msg, print_error, user_dir, format_satoshis
from bitcoin import *
@@ -160,7 +158,7 @@ class Wallet:
def init_seed(self, seed):
if self.seed: raise BaseException("a seed exists")
if not seed:
- seed = "%032x"%ecdsa.util.randrange( pow(2,128) )
+ seed = random_seed(128)
self.seed = seed
self.config.set_key('seed', self.seed, True)
self.config.set_key('seed_version', self.seed_version, True)