def pbox(word): binary_word = cast(word, "binary") return int(''.join(binary_word[offset::8] for offset in range(8)), 2)