From 5da3cab24b2a9b93e92f2febf0cae43d7287763c Mon Sep 17 00:00:00 2001 From: thomasv Date: Sun, 24 Feb 2013 10:16:14 +0100 Subject: [PATCH] move seed generation function to bitcoin.py --- lib/bitcoin.py | 4 ++++ lib/wallet.py | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/bitcoin.py b/lib/bitcoin.py index dc0952323..3d888bbd7 100644 --- 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 index 232e2025a..bea6ca5a4 100644 --- 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)