def wiftoaddr(s): if s == "": return False compressed = not s[0] == '5' from mmgen.bitcoin import wiftohex,privnum2addr hex_key = wiftohex(s,compressed) if not hex_key: return False return privnum2addr(int(hex_key,16),compressed)
def wif2hex(wif,compressed=False): Msg(bitcoin.wiftohex(wif,compressed))
def wif2addr(wif,compressed=False): s_enc = bitcoin.wiftohex(wif,compressed) if s_enc == False: die(1,"Invalid address") addr = bitcoin.privnum2addr(int(s_enc,16),compressed) Vmsg_r("Addr: "); Msg(addr)
def randwif(compressed=False): r_hex = ba.hexlify(get_random(32)) enc = bitcoin.hextowif(r_hex,compressed) dec = bitcoin.wiftohex(enc,compressed) print_convert_results(r_hex,enc,dec,"hex")
def is_wif(s): if s == "": return False compressed = not s[0] == '5' from mmgen.bitcoin import wiftohex return wiftohex(s,compressed) is not False