Photo by Nick Fewings on Unsplash

Having Fun With Ciphers: Bitwise Rotations and the Rotate Cipher

--

I love cryptography — and which is the art of scrambling and unscrambling. Sometimes we just need the method of scrambling to unscramble, and sometimes we need to add a secret key to make the process work. To hide a message, we might just simply hide it by encoding it in a certain way, and the just keep the method of encoding secret.

Two of the most basic operations that we have in cryptography are rotate and EX-OR (Exclusive-OR), and the great thing about these two operators is that when we apply them, we can easily reverse them without losing any information. It should be noted that the rotate operation is not the bit shift operation, as a bit shift will lose bits as they fall off the start or end of the byte value. In this case, we will look at a rotate right and rotate left bitwise operation.

The Rotate Cipher

Ciphers are typically used in love and war. While ciphers have typically been replaced by encryption, they are excellent ways to learn how we can encode messages with different methods of processing. Let me start with a puzzle:

A cipher takes each of the characters in a message, and 
rotates them one bit position to the right. If the encoded hex
pattern is 2ab2b93ab437b3, what is the message?

--

--

Prof Bill Buchanan OBE FRSE
ASecuritySite: When Bob Met Alice

Professor of Cryptography. Serial innovator. Believer in fairness, justice & freedom. Based in Edinburgh. Old World Breaker. New World Creator. Building trust.