mirror of
https://github.com/The-Art-of-Hacking/h4cker.git
synced 2024-12-29 15:55:26 +00:00
923 B
923 B
Challenge 6: Digital Signature Forgery
Level: Advanced
Description: Provide a digital signature scheme with a weakness (e.g., using a small prime number). 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:
- Understand the weakness in the provided RSA signature scheme.
- Forge a signature for the new message.
- Validate the forged signature.
Answer: For the message "WORLD," a forged signature could be 115.
Code:
n = 391
e = 3
message = "WORLD"
# Compute numeric representation of message
message_numeric = sum([ord(c) * (256 ** i) for i, c in enumerate(message[::-1])])
# Compute forged signature
forged_signature = message_numeric ** e % n
print("Forged signature:", forged_signature)