"""BTCQ-specific hashing functions."""
import hashlib


def sha3_256(x: bytes) -> bytes:
    """SHA3-256 hash. Used for txid, block hash, scripthash."""
    return hashlib.sha3_256(x).digest()


def hash_160_btcq(x: bytes) -> bytes:
    """BTCQ address hash: SHA3-256 truncated to 20 bytes."""
    return sha3_256(x)[:20]
