Skip to content

This Python program implements the K-Rail Fence Cipher, a type of substitution cipher, for encrypting and decrypting messages. The K-Rail Fence Cipher involves creating a zigzag pattern of characters in a matrix with 'rails,' and then reading the characters in a specific order to generate the ciphertext or retrieve the original plaintext.

License

Notifications You must be signed in to change notification settings

LeoMartinezTAMUK/K-Rail_Fence_Cipher_Encryption-Decryption

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

K-Rail Fence Cipher Encryption/Decryption Algorithm

Authors: Leo Martinez III

Contact: leo.martinez@students.tamuk.edu

Created: Spring 2024


This Python program implements the K-Rail Fence Cipher, a type of substitution cipher, for encrypting and decrypting messages. The K-Rail Fence Cipher involves creating a zigzag pattern of characters in a matrix with 'rails,' and then reading the characters in a specific order to generate the ciphertext or retrieve the original plaintext.

Encryption:

  • The encryption method fills a matrix in a zigzag pattern based on the key (number of rails) and then extracts the characters to form the ciphertext.
  • Spaces are ignored during encryption for better readability.

Decryption:

  • The decryption method reconstructs the zigzag pattern with markers, fills the matrix with characters from the ciphertext, and reads the matrix to obtain the original plaintext.

Usage:

  • The program prompts the user to choose between encryption ('e') or decryption ('d').
  • Users enter the key (number of rails), ensuring it is an integer greater than or equal to 2.
  • Example values for ciphertext and plaintext are provided for testing purposes.

Note:

  • Program was created in Google Colab with Python 3.9

Folder Contents:

  • src: Folder containing the source code python script: main.py (use this file to run the program)
  • README.md: Contains the most basic information about the project
  • LICENSE: Contains license information in regards to the Github repository

Additional Information:

  • Everything needed along with additional installation information to run the program will be contained in this folder.

About

This Python program implements the K-Rail Fence Cipher, a type of substitution cipher, for encrypting and decrypting messages. The K-Rail Fence Cipher involves creating a zigzag pattern of characters in a matrix with 'rails,' and then reading the characters in a specific order to generate the ciphertext or retrieve the original plaintext.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages