Shift Cipher
ENCODE | DECODE | CASE | MOVE | ASCII | USAGE |
Aim
This page shows you how to add text boxes to the Simple Shift Alphabet. so that you can encode and decode messages.
Make sure that you have a good backup or two of your previous workbook in case you trash it when you alter it!
Adding text boxes.
Using This Page.The page that you have made can actually be used with three different types of mono-alphabetic substitution cipher.
| ||
Keyword Ciphers.To generate a keyword cipher the easiest method is to add two more buttons and adapt the code from the existing ENCODE and DECODE buttons. Type your keyword in at the start of row 3. The keyword cannot contain the same letter twice. (Or else you must eliminate its repetition.) The rest of the alphabet minus the letters of the keyword follows on after the keyword.
Open the VBA editor by double clicking on the "ROW 3 ENCODE" button. Then cut and paste the code from the first ENCODE button into your new one. You only need to alter one line of code. Change the line that reads: newStr = newStr + Worksheets("Sheet1").Cells(2, countpos).Value To read: newStr = newStr + Worksheets("Sheet1").Cells(3, countpos).Value Save and return to the normal spreadsheet screen and test your new encoding button. Decoding from the row 3 cipher.Open the VBA editor by double clicking on the "ROW 3 DECODE" button. Then cut and paste the code from the first DECODE button into your new one. You only need to alter one line of code. Change the line that reads: codeStr = codeStr + Worksheets("Sheet1").Cells(2, n).Value To read: codeStr = codeStr + Worksheets("Sheet1").Cells(3, n).Value Save and return to the normal spreadsheet screen and test your new decoding button. Test your controls very carefully with simple messages to check that they do exactly what you expect. Encode and decode messages by hand to be sure that everything is working. Random cipher.Type a random alphabet in instead of one with a keyword but be careful to keep a copy and not to repeat letters.Trial DecodeIf you are guessing a cipher alphabet then type your guesses into row 3. Your guesses will probably arise from frequency analysis or spotting repeated letter groups.Add an new button to the spreadsheet and call it TRIAL DECODE. Cut and paste the code from ROW 3 DECODE into its VBA section. Then change the top for loop to cope with blanks in the cipher alphabet in row 3 Change this code:
For n = 1 To 26 To this: For n = 1 To 26 trialStr = Worksheets("Sheet1").Cells(3, n).Value If (trialStr = " ") Then trialStr = "*" End If codeStr = codeStr + trialStr Next n And change the line that reads: newStr = newStr + " " To this: newStr = newStr + "*" Save and return to the normal spreadsheet screen and test your new trial decoding button. Test your controls very carefully with simple messages to check that they do exactly what you expect. Encode and decode messages by hand to be sure that everything is working. |
last updated 4th July 2013