Skip to content

ThuyNT13/CipherVignere

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Cryptography - Vigenère Cipher

practice C++ and creating Encryption Algorithms

initially created on repl.it


encrypt: Ci = (Pi + Kj) mod 26

  • implicit typecast conversion to ASCII code
  • add up values
  • mod 26 converting sum to 0-25

decrypt: Pi = (Ci – Kj) mod 26

  • implicit typecast conversion to ASCII code
  • subtract values and add 26 (for neg nums)
  • mod 26 converting to 0-25
  • int decipherIndex = (cipherText[i] - key[i] + 26) % 26;

C = cipher text

P = plain text

K = key char - alpha key to derive cipher text offset

i = the ith character in the plain text, corresponding with cipher text index

j = jth character of the key

mod 26 returns an index within alphabetic range, 0-25

ASCII

Utilizing ASCII table's mapping of character to decimal code to convert alphabet to integer, and vice versa.

Present issues with code here.

Releases

No releases published

Packages

No packages published

Languages