1
0

move mnemonic to separate class and use slush's wordlist. new commands: make_seed and check_seed

This commit is contained in:
ThomasV
2014-08-28 15:37:42 +02:00
parent 94a5d26013
commit 4dcdcbc068
8 changed files with 3857 additions and 1733 deletions

View File

@@ -111,17 +111,9 @@ def Hash(x):
hash_encode = lambda x: x[::-1].encode('hex')
hash_decode = lambda x: x.decode('hex')[::-1]
hmac_sha_512 = lambda x,y: hmac.new(x, y, hashlib.sha512).digest()
def mnemonic_to_seed(mnemonic, passphrase):
from pbkdf2 import PBKDF2
import hmac
PBKDF2_ROUNDS = 2048
return PBKDF2(mnemonic, 'mnemonic' + passphrase, iterations = PBKDF2_ROUNDS, macmodule = hmac, digestmodule = hashlib.sha512).read(64)
is_new_seed = lambda x: hmac_sha_512("Seed version", x.encode('utf8')).encode('hex')[0:2].startswith(SEED_PREFIX)
def is_old_seed(seed):
import mnemonic
words = seed.strip().split()