Hello, Welcome To

ENCRYPTION AND DECRYPTION DEMO

Develop by Twelve Studio
ITE G10 M1 Group 3

View Document

Documentation

What is Encryption and Decryption?

Encryption is the process of converting readable data (called plaintext) into unreadable code (called ciphertext) so that unauthorized people can’t read it. It protects your data from hackers, spies, or anyone who shouldn’t see it.

Example:

Imagine you want to send the message:

"HELLO"

But you don’t want anyone to read it except your friend.

So you encrypt it using a secret method (for example, Caesar cipher shift by 3):

  • H β†’ K
  • E β†’ H
  • L β†’ O
  • L β†’ O
  • O β†’ R

Now the encrypted message is:

"KHOOR"

Decryption is the reverse process: turning the ciphertext back into the original readable message (plaintext) using a key. Only someone with the correct key can decrypt and read the original message.

What is Caesar Cipher?

The Caesar Cipher is a substitution encryption technique where each letter in the plaintext is shifted a certain number of places down the alphabet.

For example, with a shift of 3, A becomes D, B becomes E, and so on. It's simple, fast, but easy to break.

πŸ“œ How It Works:

  1. Choose a shift key (e.g., 3)
  2. Shift each letter forward in the alphabet by that number
  3. Letters wrap around from Z to A
It's called the Caesar cipher because it was used by Julius Caesar to protect his military messages.

What is RSA Cipher?

RSA is a public-key (asymmetric) encryption algorithm.
It uses two keys:

  • A public key to encrypt
  • A private key to decrypt

Unlike Caesar Cipher, RSA doesn’t rely on shifting letters β€” it uses math and prime numbers for secure communication.


🧠 Why is it called β€œRSA”?

It’s named after its inventors:

  • Rivest
  • Shamir
  • Adleman

They created RSA in 1977.

βœ… RSA Step-by-Step Example

Let's use the same example as your textbook:

πŸ”‘ Key Generation:

  • Choose primes: p = 43, q = 59
  • Calculate n = p Γ— q = 43 Γ— 59 = 2537
  • Calculate Ο†(n) = (p-1)(q-1) = 42 Γ— 58 = 2436
  • Choose e = 13 (must be coprime with Ο†(n))
  • Calculate d = 937 (the inverse of e)

πŸ” Encryption (STOP β†’ [2081, 2182]):

  • Convert: S=18, T=19, O=14, P=15
  • Group: 1819, 1415
  • Encrypt: 1819^13 mod 2537 = 2081
  • Encrypt: 1415^13 mod 2537 = 2182

This matches your calculator's textbook example!

πŸ” Encryption:

ciphertext = (73) % 33

You send 13.

πŸ”“ Decryption:

plaintext = (137) % 33

You got the original number back: 7.

βœ… Real-World Usage:

  • RSA is used in HTTPS websites
  • In digital signatures
  • For secure email and messaging
  • In blockchain and cryptocurrency

πŸ”’ Why RSA is Powerful:

  • Super secure (if large primes are used)
  • Public key can be shared with anyone
  • Private key stays secret