From b082a293ce1ce536354f9b12bf748d95d36162e8 Mon Sep 17 00:00:00 2001 From: Omar Santos Date: Tue, 15 Aug 2023 09:43:27 -0400 Subject: [PATCH] Create 01_Classic_Caesar_Cipher.md --- crypto/challenges/01_Classic_Caesar_Cipher.md | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 crypto/challenges/01_Classic_Caesar_Cipher.md diff --git a/crypto/challenges/01_Classic_Caesar_Cipher.md b/crypto/challenges/01_Classic_Caesar_Cipher.md new file mode 100644 index 0000000..2809c17 --- /dev/null +++ b/crypto/challenges/01_Classic_Caesar_Cipher.md @@ -0,0 +1,47 @@ +# Challenge 1: Caesar Cipher Shift + +**Challenge Text:** +``` +Sifnz ebjnt, zpv ibwf cffo difdlfe! Dpvme zpv efdszqujpo uijt tfdsfu nfttbhf? +``` + +**Instructions:** +1. Analyze the frequency of the letters, or use a brute-force approach to find the shift value. +2. Write a program or manually shift the letters to decrypt the message, applying the reverse shift. +3. Provide the original text. + +### Answer: + +The Caesar cipher is a type of substitution cipher in which each character in the plaintext is 'shifted' a certain number of places down or up the alphabet. In this particular case, the shift value is 1. + +**Decrypted Text:** +``` +Rhemy dakim, you have been checked! Could you decrypting this secret message? +``` + +You can also use these code examples in Python to decrypt the message: + +```python +def decrypt_caesar(ciphertext, shift): + decrypted = "" + for char in ciphertext: + if char.isalpha(): + shifted = ord(char) - shift + if char.islower(): + if shifted < ord('a'): + shifted += 26 + elif char.isupper(): + if shifted < ord('A'): + shifted += 26 + decrypted += chr(shifted) + else: + decrypted += char + return decrypted + +ciphertext = "Sifnz ebjnt, zpv ibwf cffo difdlfe! Dpvme zpv efdszqujpo uijt tfdsfu nfttbhf?" +shift = 1 +decrypted_text = decrypt_caesar(ciphertext, shift) +print(decrypted_text) +``` + +This challenge serves as a fun and educational introduction to the field of cryptography, allowing you to explore basic decryption techniques. Try the next challenge.