Skip to content

abdullansari/Nexus

Repository files navigation

#THIS README FILE IS STILL A WORK IN PROGRESS.

=============================INSTRUCTIONS============================

Nexus combines the Caesar and Monoalphabetic ciphers to provide robust encryption and decryption.


Before diving into the processes, here are some key points to note:

-Caesar Cipher: Shifting key value is obtained from the 4th character in every block of 9 characters. -Monoalphabetic Cipher: Utilizes a fixed substitution method based on a predefined key table. Refer to Table X for the monoalphabetic keys.

Table X: Monoalphabetic Substitution Key Table +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | y | z | +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ | h | i | L | w | m | k | b | d | p | c | v | a | z | u | s | j | g | r | y | n | q | x | o | f | t | e | +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+

Now that the preliminaries are out of the way, let's delve into the processes.

Nexus takes user input for a FILENAME. Then, the user specifies whether they want to encrypt or decrypt the file.

Now, since both encrption and decryption are the inverse of each other (obviously) we will explain only the encryption process in detail.

----------------------------PREPROCESSING----------------------------

  • Convert entire input message to lowercase letters.
  • Remove spaces, or whitespaces, at both ends as well as inter-words.

----------------------------ENCRYPTION STEPS-------------------------

  • Step 1: Apply substitution based on Caesar-style shifts on 3 letters. Each letter is shifted by a defined key. This key is obtained from the alphabetical index value of the fourth letter in the plaintext.
  • Step 2: Apply monoalphabetic (mono) substitution on next 6 letters. Each character is substituted by its respective pair from Table X above. -------------------------------PADDING-------------------------------
  • Since 3 letters are encrypted using Caesar and 6 letters using mono, the input message is processed in blocks of 9 characters.
  • In case the plaintext length is not divisible by 9 and the last remaining letters are to be encrypted using Caesar, a padding of 'xyz' is added to the end of the message.
  • After encryption is complete using the index of either x, y, or z, the padding is removed.

----------------------------EXAMPLE USAGE---------------------------- Input Message : HELLO WORLD Preprocessed : helloworld Length : 10 Encrypted with: helloworld CCCMMMMMMC

Step 1: Encrypt 'hel' using Caesar with shift from 'l' (4th letter) h -> s (shift 11), e -> p (shift 11), l -> w (shift 11) --> 'spw' Step 2: Encrypt 'loworl' using Mono substitution l -> a, o -> s, w -> o, o -> s, r -> r, l -> a --> 'asosra' Step 3: Add padding 'xyz' to obtain key for Caesar to encrypt 'd' dxyz -> z is the 4th letter, shift = 25 --> 'c' Final Encrypted Message: 'spwasosrac'


=====================================================================

About

An encryption/decryption algorithm that makes use of Caesar and monoalphabetic substitution to encrypt/decrypt from files and write to files.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages