Ejemplo n.º 1
0
def is_old_seed(seed):
    import old_mnemonic, mnemonic
    seed = mnemonic.normalize_text(seed)

    words = seed.strip().split()
    try:
        old_mnemonic.mn_decode(words)
        uses_uwallet_words = True
    except Exception:
        uses_uwallet_words = False
    try:
        seed.decode('hex')
        is_hex = (len(seed) == 32 or len(seed) == 64)
    except Exception:
        is_hex = False
    return is_hex or (uses_uwallet_words and
                      (len(words) == 12 or len(words) == 24))
Ejemplo n.º 2
0
def is_new_seed(x, prefix=version.SEED_PREFIX):
    import mnemonic
    x = mnemonic.normalize_text(x)
    s = hmac_sha_512("Seed version", x.encode('utf8')).encode('hex')
    return s.startswith(prefix)
Ejemplo n.º 3
0
def is_new_seed(x, prefix=version.SEED_PREFIX):
    import mnemonic
    x = mnemonic.normalize_text(x)
    s = hmac_sha_512("Seed version", x.encode('utf8')).encode('hex')
    return s.startswith(prefix)