def _permute(c, p):
    """Returns the permutation of the given 32-bit or 64-bit code with
    the specified permutation table."""
    # NOTE: only difference between 32 & 64 bit permutations
    #       is that len(p)==8 for 32 bit, and len(p)==16 for 64 bit.
    out = 0
    for r in p:
        out |= r[c&0xf]
        c >>= 4
    return out