-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
25 additions
and
4 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
The previous challenge gave you the one time pad to decrypt the ciphertext. | ||
If you did not know the one time pad, and it was only ever used for one message, the previous challenge would be unsolvable! | ||
In this level, we'll explore what happens if the latter condition is violated. | ||
You don't get the key this time, but we'll let you encrypt as many messages as you want. | ||
Can you decrypt the flag? | ||
|
||
---- | ||
**Hint:** understand deeply about how XOR works, and consider that it is a distributative, commutative, and associative operation... |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/opt/pwn.college/python | ||
|
||
import base64 | ||
from Crypto.Random import get_random_bytes | ||
from Crypto.Util.strxor import strxor | ||
|
||
flag = open("/flag", "rb").read() | ||
|
||
key = get_random_bytes(256) | ||
ciphertext = strxor(flag, key[:len(flag)]) | ||
print(f"secret ciphertext: {base64.b64encode(ciphertext).decode()}") | ||
|
||
while True: | ||
plaintext = base64.b64decode(input("plaintext (b64): ")) | ||
ciphertext = strxor(plaintext, key[:len(plaintext)]) | ||
print(f"ciphertext: {base64.b64encode(ciphertext).decode()}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters