X-Git-Url: https://git.novaco.in/?p=electrum-server.git;a=blobdiff_plain;f=utils%2F__init__.py;h=f6e64f2bde828014a1d0c44fe8bf05750768612d;hp=95c6c17e63ba7b252014b6afd588cbd0c9a7eada;hb=4ce69b7ea24ead59ebbcc7ed335ea9762ae3724b;hpb=c9c337a89a3f04d7a985a521ca552d421fd94fda diff --git a/utils/__init__.py b/utils/__init__.py index 95c6c17..f6e64f2 100644 --- a/utils/__init__.py +++ b/utils/__init__.py @@ -74,7 +74,7 @@ def header_to_string(res): def hex_to_int(s): - return eval('0x' + s[::-1].encode('hex')) + return int('0x' + s[::-1].encode('hex'), 16) def header_from_string(s): @@ -90,7 +90,6 @@ def header_from_string(s): ############ functions from pywallet ##################### -addrtype = 0 def hash_160(public_key): @@ -108,7 +107,7 @@ def public_key_to_bc_address(public_key): return hash_160_to_bc_address(hash_160(public_key)) -def hash_160_to_bc_address(h160): +def hash_160_to_bc_address(h160, addrtype = 0): if h160 == 'None': return 'None' vh160 = chr(addrtype) + h160 @@ -194,21 +193,6 @@ def DecodeBase58Check(psz): return key -def PrivKeyToSecret(privkey): - return privkey[9:9+32] - - -def SecretToASecret(secret): - vchIn = chr(addrtype+128) + secret - return EncodeBase58Check(vchIn) - - -def ASecretToSecret(key): - vch = DecodeBase58Check(key) - if vch and vch[0] == chr(addrtype+128): - return vch[1:] - else: - return False ########### end pywallet functions #######################