Skip to content

devishi-r/cryptography-codes

Repository files navigation

cryptography-codes

  1. Playfair Cipher:
    The Playfair cipher is a substitution cipher that encrypts pairs of letters of a text using a 5x5 matrix of letters derived from a keyword.
    Encryption:
    i) If the two letters are in the same row, replace them with the letters to their immediate right.
    ii) If they are in the same column, replace them with the letters directly below them.
    iii) If they form a rectangle, replace them with the letters on the same row but at the opposite corners of the rectangle.

Functions:
Input: plaintext, keytext Output: Key matrix, ciphertext, decrypted plaintext

  • construct_key_matrix(key)
  • prepocess_plaintext(plaintext)
  • encrypt
  • decrypt
  • get_positions(element, keymatrix): called in encrypt and decrypt functions
  1. Hill Cipher: Polygraphic substitution cipher using matrix multiplication
  • C = (K*P) mod 26
  • P = (K_inv*C) mod 26

Functions: Input: plaintext, keymatrix Output: ciphertext, decrypted plaintext

  • encrypt()
  • decrypt()
  • text_to_numbers(text) : called by enc and dec functions
  • numbers_to_text(numbers) : called by enc and dec functions
  1. DES Initial and Final Permutation Boxes: Input: plaintext(64-bit)
  • ' '.join(input_bits[i-1] for i in INITIAL/FINAL_PERM_TABLE)
  1. DES S-boxes:
    Input: binary input (48 bits)

  2. AES Mix Columns operation:

  1. AES Key Expansion

  2. RSA

  3. Diffie-Hellman

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages