mirror of
https://github.com/The-Art-of-Hacking/h4cker
synced 2024-11-21 18:33:03 +00:00
Create 06_Digital_Signature_Forgery_Advanced.md
This commit is contained in:
parent
0cd4c91d5b
commit
8613977ff3
1 changed files with 38 additions and 0 deletions
38
crypto/challenges/06_Digital_Signature_Forgery_Advanced.md
Normal file
38
crypto/challenges/06_Digital_Signature_Forgery_Advanced.md
Normal file
|
@ -0,0 +1,38 @@
|
|||
# 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:**
|
||||
1. Understand the weakness in the provided RSA signature scheme.
|
||||
2. Forge a signature for the new message.
|
||||
3. Validate the forged signature.
|
||||
|
||||
|
||||
**Answer:**
|
||||
For the message "WORLD," a forged signature could be 115.
|
||||
|
||||
**Code:**
|
||||
```python
|
||||
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)
|
||||
```
|
||||
|
Loading…
Reference in a new issue