A rolling cipher, also called a progressive cipher, is a primitive form of substitution encryption which uses a rolling key. Like the Caesar cipher, each letter is shifted forward along the alphabet, looping back around the beginning of alphabet as needed. However, while the Caesar cipher uses a fixed value to shift all of the letters in the message the same amount, a rolling cipher uses an incrementing value to make it harder to crack. For example, the word HELLO would be encrypted with the H shifting forward one letter in the alphabet, the E two letters, the L three letters, and so forth, which would result in IGOPT.
The starting number to shift, as well as how many increments to make before returning to the starting number make up the key and must be known to both encrypt and decrypt the message.
To encrypt text using a rolling cipher, first, decide on the number to begin shifting at, then, decide on how many times you'll increment before returning to the starting number. For example, starting at 3 and incrementing until 8 will produce a shift that looks like 3, 4, 5, 6, 7, 8, 3, 4, ... With this pattern, take your plain text and shift each letter forward along the alphabet according to the incrementing pattern. If the letter would go beyond Z, simply loop back to A. So, a Y shifted ahead 5 would produce a D.
The following example uses a rolling pattern which beings with a shift of 10 and increments until the shift reaches 20, and then drops back to 10.
plaintext: TESTING THE ROLLING CIPHER. key: 10-20 ciphertext: DPEGWCW KZX LYWXVBV SZHAYB.
To decrypt ciphertext that has been encrypted with the rolling cipher, you need only to rotate the letters the same number of places in the opposite direction in which they were shifted in the encryption process, while maintaining the same rolling pattern. Letters that would be shifted before A simply loop around to Z.
ciphertext: FHGWASXNPJ XMG USQNLRL ELTMGU. key: 2-5 plaintext: DECRYPTING THE ROLLING CIPHER.
- The rolling cipher is easy to use. Short messages can be encrypted and decrypted in your head, and you don't need any mathematical skills beyond counting to use it.
- The rolling cipher is harder to crack than the Caesar cipher. In addition to eliminating the ability to perform simple substitutions across the entire message, the rolling cipher is better at obfuscating repeating letters than the Caesar cipher. For example, the word BALLOON, when encrypted with a Caesar cipher shifted three places becomes EDOORRQ. Even if you can't identify the word, you can tell immediately that it contains two double letters which dramatically narrows down the number of possible words it could be. However, in a rolling cipher of 2-4, BALLOON becomes DDPNRSP, which not only hides both double letters, but creates a false double letter which will confused anyone assuming a Caesar cipher was used.
- Because it follows such a simple pattern, the rolling cipher can be cracked fairly simply as well. By brute forcing various starting values, and reviewing their results, it quickly becomes apparant what number the rolling starts at, and, by seeing when the text becomes garbled again, you can quickly infer when the incrementing resets.
- The nature of the cipher gives clues that it has been used. Double letters are better hidden than in a Caesar cipher, but they're still problematic. For example, RACCOON using a rolling cipher of 1-10 becomes SCFGTUU. The CC becomes FG and the OO becomes TU. Notice that both double letters become pairs where the second letter is the next one in the alphabet. When you see this a lot in the ciphertext, it's a good indicator that a rolling cipher was used, which speeds up the cracking process dramatically.
- Because it is private key encryption, the key must be known by the recipient of the ciphertext, so it could be intercepted, or the recipient could be persuaded to reveal it. Such a deficiency is solved with public key encryption.
To help confound a cracker, you can change up various factors in the rolling. For example, instead of incrementing the shift value by one each time, increment by three, or, instead of incrementing using a fixed integer, use a geometrical increment like: 1, 2, 4, 8, 16, or a portion of the Fibonacci sequence like: 1, 2, 3, 5, 8, 13, 21. However, the more complicated you make your rolling rule, the more must be included in the key, and the harder it becomes to encrypt and decrypt.
This FreeBASIC program will encode and decode text with a basic rolling cipher.
' This program will encode or decode text by using a rolling cipher. ' Copyright 2019-07-11 - Dean Tersigni Dim As String Choice Dim As String PlainText Dim As String CipherText Dim As Integer StartRoll Dim As Integer EndRoll Dim As Integer CurrentRoll Dim As Integer Place Dim As Integer Code Dim As String Letter Do Input "(E)ncode or (D)ecode? ", Choice Print Choice = UCase(Choice) Select Case Choice Case "E", "D" Exit Do Case Else Print "Please enter E or D." Print End Select Loop If Choice = "E" Then Input "Type the plaintext to encode: ", PlainText PlainText = UCase(PlainText) Do Input "Starting roll number? ", StartRoll Input "Ending roll number? ", EndRoll Print If StartRoll < EndRoll And StartRoll > 0 And EndRoll > 0 Then Exit Do Else Print "Start must be less than end, and both must be greater than zero." End If Loop CurrentRoll = StartRoll For Place = 1 To Len(PlainText) Letter = Mid(PlainText, Place, 1) Code = ASC(Letter) If Code > 64 And Code < 91 Then Code = Code + CurrentRoll If Code > 90 Then Code = Code - 26 End If CurrentRoll = CurrentRoll + 1 If CurrentRoll > EndRoll Then CurrentRoll = StartRoll End If End If CipherText = CipherText + Chr(Code) Next Place Print "Your ciphertext is: " + CipherText Else Input "Enter the ciphertext to decode: ", CipherText CipherText = UCase(CipherText) Do Input "Starting roll number? ", StartRoll Input "Ending roll number? ", EndRoll Print If StartRoll < EndRoll And StartRoll > 0 And EndRoll > 0 Then Exit Do Else Print "Start must be less than end, and both must be greater than zero." End If Loop CurrentRoll = StartRoll For Place = 1 To Len(CipherText) Letter = Mid(CipherText, Place, 1) Code = ASC(Letter) If Code > 64 And Code < 91 Then Code = Code - CurrentRoll If Code < 65 Then Code = Code + 26 End If CurrentRoll = CurrentRoll + 1 If CurrentRoll > EndRoll Then CurrentRoll = StartRoll End If End If PlainText = PlainText + Chr(Code) Next Place Print "Your plaintext is: " + PlainText End If Sleep
- dcode.fr/progressive-caesar-cipher - Online rolling cipher tool.
- imasciencegeek.wordpress.com/2012/04/01/rolling-cipher - Description of the cipher.