예제 #1
0
def address_to_key(s, version=0):
    s = ('%050x' % base58_decode(s)).decode('hex')
    key, check0 = s[:-4], s[-4:]
    check1 = dhash(key)[:4]
    if key[0] != chr(version) or check0 != check1:
        raise BadAddress(s)
    return key[1:]
예제 #2
0
def address_to_key (s, version=0):
    s = ('%050x' % base58_decode (s)).decode ('hex')
    key, check0 = s[:-4], s[-4:]
    check1 = dhash (key)[:4]
    if key[0] != chr(version) or check0 != check1:
        raise BadAddress (s)
    return key[1:]
예제 #3
0
def address_to_key (s):
    # strip off leading '1'
    s = ('%048x' % base58_decode (s[1:])).decode ('hex')
    hash160, check0 = s[:-4], s[-4:]
    check1 = dhash ('\x00' + hash160)[:4]
    if check0 != check1:
        raise BadAddress (s)
    return hash160
예제 #4
0
def address_to_key(s):
    # strip off leading '1'
    s = ('%048x' % base58_decode(s[1:])).decode('hex')
    hash160, check0 = s[:-4], s[-4:]
    check1 = dhash('\x00' + hash160)[:4]
    if check0 != check1:
        raise BadAddress(s)
    return hash160
예제 #5
0
파일: bitcoin.py 프로젝트: npc7/caesure
def address_to_key (s):
    n = base58_decode (s)
    # <version:1><hash:20><check:4>
    check0 = struct.pack ('>L', n & 0xffffffff)
    n >>= 32
    h160 = n & h160_mask
    n >>= 160
    v = n
    h160 = ('%040x' % (h160)).decode ('hex')
    check1 = dhash (chr(v) + h160)[:4]
    if check0 != check1:
        raise BadAddress (s)
    return v, h160
예제 #6
0
def address_to_key (s):
    n = base58_decode (s)
    # <version:1><hash:20><check:4>
    check0 = struct.pack ('>L', n & 0xffffffff)
    n >>= 32
    h160 = n & h160_mask
    n >>= 160
    v = n
    h160 = ('%040x' % (h160)).decode ('hex')
    check1 = dhash (chr(v) + h160)[:4]
    if check0 != check1:
        raise BadAddress (s)
    return v, h160