Skip to content

AkheelQi/PRODIGY_CS_01

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

PRODIGY_CS_01

program shows encryption and decryption using the Caesar Cipher algorithm!. The Caesar's algorithm is one of the major algorithm in human history named after Julius Caesar. The Caesar Cipher algorithm is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher where each letter in the plaintext is shifted a certain number of places down or up the alphabet.

How the Caesar Cipher Works:

  1. Shift Value: The core idea of the Caesar Cipher is to replace each letter in the plaintext with a letter a fixed number of positions down or up the alphabet. This fixed number is known as the "shift" or "key".

  2. Encryption:

    • For encryption, you take each letter in the plaintext and shift it to the right by the shift value.
    • For example, with a shift of 3:
      • 'A' becomes 'D'
      • 'B' becomes 'E'
      • 'C' becomes 'F'
      • and so on.
    • If the shift reaches past 'Z', it wraps around to the beginning of the alphabet. So, with a shift of 3:
      • 'X' becomes 'A'
      • 'Y' becomes 'B'
      • 'Z' becomes 'C'
  3. Decryption:

    • For decryption, you take each letter in the ciphertext and shift it to the left by the shift value.
    • This reverses the encryption process, returning the original plaintext.

Example:

Suppose we want to encrypt the message "HELLO" with a shift of 3:

  • 'H' becomes 'K'
  • 'E' becomes 'H'
  • 'L' becomes 'O'
  • 'L' becomes 'O'
  • 'O' becomes 'R'

So, "HELLO" with a shift of 3 becomes "KHOOR".

Characteristics:

  • Simplicity: The Caesar Cipher is very simple to understand and implement.
  • Vulnerability: Due to its simplicity, it is also very easy to break. There are only 25 possible shifts (ignoring the trivial shift of 0), so a brute-force attack can easily reveal the original message.
  • Historical Use: Used by Julius Caesar, who reportedly used it to communicate with his officials.

Mathematical Representation:

If the alphabet is considered as a circular structure with positions 0 to 25, the encryption of a letter ( x ) by a shift ( n ) can be described by: [ E(x) = (x + n) \mod 26 ] Similarly, decryption can be described by: [ D(x) = (x - n) \mod 26 ]

Here, ( x ) is the position of the letter in the alphabet (A = 0, B = 1, ..., Z = 25).

Limitations:

  • The Caesar Cipher does not provide strong security and is not suitable for modern encryption needs. More complex algorithms like the Vigenère cipher, and modern methods like RSA and AES, are used for secure communication.

Despite its limitations, the Caesar Cipher is an excellent introduction to the concepts of encryption and the idea of transforming information to protect its content.

About

program shows encryption and decryption using the Caesar Cipher algorithm!. The Caesar's algorithm is one of the major algorithm in human history named after Julius Caesar.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages