mirror of
https://github.com/The-Art-of-Hacking/h4cker
synced 2024-11-21 18:33:03 +00:00
Update 04_Classic_Vigenere_Cipher.md
This commit is contained in:
parent
63f4550d6b
commit
57119589e9
1 changed files with 16 additions and 38 deletions
|
@ -1,6 +1,4 @@
|
||||||
Certainly! Here are three additional cryptographic challenges suitable for your class, ranging in difficulty:
|
# Challenge 4: Classic Vigenère Cipher
|
||||||
|
|
||||||
### Challenge 4: Classic Vigenère Cipher
|
|
||||||
|
|
||||||
**Level:** Beginner
|
**Level:** Beginner
|
||||||
|
|
||||||
|
@ -17,42 +15,22 @@ Keyword: "KEYWORD"
|
||||||
1. Utilize the given keyword to decrypt the Vigenère cipher.
|
1. Utilize the given keyword to decrypt the Vigenère cipher.
|
||||||
2. Provide the original plaintext.
|
2. Provide the original plaintext.
|
||||||
|
|
||||||
### Challenge 5: Implement Diffie-Hellman Key Exchange
|
|
||||||
|
|
||||||
**Level:** Intermediate
|
**Answer:**
|
||||||
|
The decrypted message is "WELCOMETOTHEWORLDOFCRYPTOGRAPHY"
|
||||||
|
|
||||||
**Description:**
|
**Code:**
|
||||||
Simulate the Diffie-Hellman key exchange algorithm to securely share a symmetric key between two parties.
|
```python
|
||||||
|
def decrypt_vigenere(ciphertext, keyword):
|
||||||
|
keyword_repeated = (keyword * (len(ciphertext) // len(keyword))) + keyword[:len(ciphertext) % len(keyword)]
|
||||||
|
decrypted_text = ''
|
||||||
|
for i in range(len(ciphertext)):
|
||||||
|
decrypted_char = chr(((ord(ciphertext[i]) - ord(keyword_repeated[i])) % 26) + ord('A'))
|
||||||
|
decrypted_text += decrypted_char
|
||||||
|
return decrypted_text
|
||||||
|
|
||||||
**Challenge Text:**
|
ciphertext = "XBGXLTVJZTFKTRDCXWPNCRTGDHDDJQKFTZR"
|
||||||
|
keyword = "KEYWORD"
|
||||||
|
decrypted_text = decrypt_vigenere(ciphertext, keyword)
|
||||||
|
print(decrypted_text)
|
||||||
```
|
```
|
||||||
Given prime p = 23, base g = 5
|
|
||||||
Party A's private key: 6
|
|
||||||
Party B's private key: 15
|
|
||||||
```
|
|
||||||
|
|
||||||
**Instructions:**
|
|
||||||
1. Compute Party A's and Party B's public keys.
|
|
||||||
2. Compute the shared secret key for both parties.
|
|
||||||
3. Validate that both parties have the same shared secret key.
|
|
||||||
|
|
||||||
### Challenge 6: Digital Signature Forgery
|
|
||||||
|
|
||||||
**Level:** Advanced
|
|
||||||
|
|
||||||
**Description:**
|
|
||||||
Provide a digital signature scheme with a weakness (e.g., using a small prime number). Challenge the students to forge a digital signature for a new message.
|
|
||||||
|
|
||||||
**Challenge Text:**
|
|
||||||
```
|
|
||||||
Signature scheme: RSA with n = 391, e = 3, d = 107
|
|
||||||
Signed message: ("HELLO", signature = 220)
|
|
||||||
Challenge: Forge a signature for the message "WORLD"
|
|
||||||
```
|
|
||||||
|
|
||||||
**Instructions:**
|
|
||||||
1. Understand the weakness in the provided RSA signature scheme.
|
|
||||||
2. Forge a signature for the new message.
|
|
||||||
3. Validate the forged signature.
|
|
||||||
|
|
||||||
**Note:** Make sure to clarify the educational purpose of the challenges and emphasize the importance of ethical behavior and responsible use of these skills. Providing a controlled environment or sandbox for practicing these challenges will ensure that students can learn without violating any legal or ethical guidelines.
|
|
||||||
|
|
Loading…
Reference in a new issue