CTFs and solutions
This commit is contained in:
19
long-secret-message/chall-original.py
Normal file
19
long-secret-message/chall-original.py
Normal file
@ -0,0 +1,19 @@
|
||||
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 = []
|
||||
|
||||
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))
|
||||
Reference in New Issue
Block a user