Bitcoin has a special format for hashing messages for signing.

    :param message: the encoded message to hash in preparation for verifying

def bitcoin_sig_hash(message):
    """Bitcoin has a special format for hashing messages for signing.

    :param message: the encoded message to hash in preparation for verifying
    """
    padded = b'\x18Bitcoin Signed Message:\n' +\
        int_to_var_bytes(len(message)) +\
        message
    return double_sha256(padded)