Skip to content

A C implementation of a columnar transposition cipher for encryption.

Notifications You must be signed in to change notification settings

cg-2611/columnar-transposition-cipher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Columnar Transposition Cipher

This was a problem given to me at university.

The program takes a file of text, removes all characters but alphanumeric characters, and encrypts the remaining text using the alphanumeric characters of a given key.

The encryption works by creating a table where the first row is the alphanumeric characters from a given key, and then the alphanumeric characters from the text file are then put into the table beneath the key. In the cases where the table isn't perfectly filled, the empty spaces are padded with 'X' characters. Once the table has been created, the key (first column of the table) is then sorted alphabetically, where whole columns are swapped during the sorting. Finally, the encrypted text is then printed to the terminal.

Usage


The program can be compiled any way you wish, however when running the program, there are some command line arguments that need to the passed in the following order:

  • <text_file_name>: the name of the text file that contains the the text to be encrypted.
  • <key_for_cipher>: the key that will be used for the encryption

example.txt can be used to demonstrate how the program works. example.txt contains a file of random words that are organized into sentences and paragraphs, but do not make sense. Any string can be used as the key, for demonstration purposes, try using "HELLO".

Note: the key is not required to be uppercase.

About

A C implementation of a columnar transposition cipher for encryption.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages