def _polymod(values):
    """Internal function that computes the cashaddr checksum."""
    c = 1
    for d in values:
        c0 = c >> 35
        c = (c & 34359738367) << 5 ^ d
        if c0 & 1:
            c ^= 656907472481
        if c0 & 2:
            c ^= 522768456162
        if c0 & 4:
            c ^= 1044723512260
        if c0 & 8:
            c ^= 748107326120
        if c0 & 16:
            c ^= 130178868336
    retval = c ^ 1
    return retval
