def wiftohex(wifkey):
    '''
    Returns a tuple of:
    (64-char hex key, 2-char hex prefix for key, if it was compressed)
    '''

    iscompressed = False
    wifkey = normalize_input(wifkey)
    assert len(wifkey) == 50 or len(wifkey) == 51 or len(wifkey) == 52
    for c in wifkey:
        if c not in b58_digits:
            raise Exception("Not WIF")
    key = b58d(wifkey)
    prefix, key = key[:2], key[2:] 
    if len(key) == 66:
        assert key[-2:] == '01'
        key = key[:-2]
        iscompressed = True
    assert len(key) == 64
    return key, prefix, iscompressed