I'm no python coder, but if you fill an integer array with the input block bit index value instead of using some binary bit values you can generate something verifiable. Print ("Subkey " + str(i+1) + ": " + hex_subkey) Master_bin = bin(int(master, scale)).zfill(num_of_bits) Master = input("Hexidecimal key (omit 0x): ") Am I fundamentally misunderstanding something or is it just sloppy coding? def main(): I have looked over everything and I'm pretty sure I have the right idea, although this is a difficult thing to tst for correctness. Not sure why it produces incorrect results. Trying to generate DES sub-keys from master key.