import hashlib
import codecs


def hash256_twice(s):
    """
    Hash input with sha256 twice, reverse, encode to hex.
    """
    bh = hashlib.sha256(hashlib.sha256(s).digest()).digest()
    hh = codecs.encode(bh[::-1], "hex")

    return hh