ALL the CTFS of Crypto2025 finally

This commit is contained in:
emln
2025-06-02 19:35:30 +02:00
parent aa0fe54b3b
commit 50c18f35b9
442 changed files with 1743 additions and 8 deletions

View File

@ -0,0 +1,21 @@
import os
from Cryptodome.Cipher import ChaCha20
key = os.urandom(32)
nonce = os.urandom(12)
print(f"Using key: {key.hex()}, nonce: {nonce.hex()}")
with open("./hacker-manifesto.txt") as f:
lines = f.readlines()
#
#hacker-manifesto.txt encrypted in enc
enc = []
#Maybe recreating the cipher generate the same keystream?
# Yes it is.
for line in lines:
cipher = ChaCha20.new(key=key, nonce=nonce)
enc.append(cipher.encrypt(line.encode()).hex())
with open("./hacker-manifesto.enc", "w") as f:
f.write("\n".join(enc))