I am converting 3 letters into their ASCII binary notation and then incrementing the first letter by 16 places, the second letter by 8 places, and the last is staying where it is, so that when the 24 bit stream is configured, the first 8 bit places represents the first letter, the next 8 the middle letter and the last represent the last letter. Here's my code:
# create a block for the word 'Ozy'
bk1 = (ord('O')<<16) + (ord('z')<<8) + (ord('y'))
# Now take off the encryption for the block
cbk1 = ((chr(bk1>>16)) + (chr(bk1>>8)) + (chr(bk1&0xFF)))
# output of cbk1 is: 'O\u4f7ay'
So thats where the problem is, the first letter was decrypted as O
, the last letter was correct as well as y
, but for some reason it won't do the right thing for z
. What's wrong?