Skip to content

This repository houses Python implementations of cryptographic algorithms, providing a hands-on approach to understanding the fundamentals of secure communication.

Notifications You must be signed in to change notification settings

KholoudAhmedx/Cryptography

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Objective

Implementing encryption algorithms including classical ciphers such as Caesar, Vigenere, Playfair and more,and modern ciphers such as AES,RC4..etc.

Classical Ciphers

  1. Caesar Cipher
  2. Vigenere Cipher
  3. Playfair Cipher
  4. Hill Cipher: is a multi-letter substitution cipher based on linear algebra.

How Each Algorithm Works

Hill Cipher

Encryption low is :

C = E(K, P) mod 26
Each letter is represented by a number modolu 26.
Since hill cipher is a multi-letter algorithm, it means that it can encrpyt more than one letter at a time based on the size of the given key. <br > The key is a n X n matrix that is multiplied by the plaintext to get the cipher text. The formula is as the following :
image

If the key is given as a stirng, it is converted to the corresponding n X n matrix to multiply it to the plaintext.
For example: if we have Key = ciphering then the corresponding matrix is 3x3 since the length of the key is 9 characters image

Hill cipher can encrypt a group of letters based on the size of the key matrix, so if we have a 3x3 key matrix then we can encrypt 3-plaintext letters at a time, if the key matrix is 2x2 matrix then 2-plaintext letters can be encrypted at a time and so on..
For example: plaintext = "pay more money" and the key is 3x3 matrix, then we will encrypt the plaintext 3-letters at a time which means that we have p1 = pay, p2 = mor , p3= emo, p4 = ney and for each 3 letters. C1 = K x P1 mod 26 , c2 = K x P2 mod 26 and so on..
Insert the letter 'x' to the plaintext if the last substring is less than the key length.

About

This repository houses Python implementations of cryptographic algorithms, providing a hands-on approach to understanding the fundamentals of secure communication.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages