Browse Source

move seed generation function to bitcoin.py

283
thomasv 12 years ago
parent
commit
5da3cab24b
  1. 4
      lib/bitcoin.py
  2. 4
      lib/wallet.py

4
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

4
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)

Loading…
Cancel
Save