Krakin Kodes

Produce a program which will read unencrypted ‘plaintext’ text from a file and encode it with a numerical shift between 1 and 26 e.g 2.  It should write the encoded ‘ciphertext’ to a new file.

More information can be found on the shift cipher at Wikipedia.

Variable and Validation Table

Variable Name Data Type What it does? Origin Validation Req.
shift Integer Used to move each letter along the alphabet e.g. 2 would mean a = c. User Input Must be a positive integer between 0 and 26
message String This is the text that the user wants encrypted. User Input Must be an alpha numeric string of length greater than 0.
ciphertext String Stores the encoded message Process N/A

Extensions

  • Write a decryption function for the Shift Cipher.
  • Write a Function called Atbash which encodes the file using AtBash e.g. A ?Z, B ?Y, C ?X etc.
  • Write a code breaking function for the Shift Cipher.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.