1
0

extended seed prefix

This commit is contained in:
ThomasV
2014-09-09 11:51:45 +02:00
parent c657212e5b
commit 6361abaf4d
5 changed files with 23 additions and 22 deletions

View File

@@ -23,8 +23,8 @@ import re
import sys
import hmac
import version
from util import print_error
from version import SEED_PREFIX
try:
import ecdsa
@@ -147,7 +147,10 @@ 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()
is_new_seed = lambda x: hmac_sha_512("Seed version", x.encode('utf8')).encode('hex')[0:2].startswith(SEED_PREFIX)
def is_new_seed(x, prefix=version.SEED_BIP44):
s = hmac_sha_512("Seed version", x.encode('utf8')).encode('hex')
return s.startswith(prefix)
def is_old_seed(seed):