crypto: add already solved challenges

This commit is contained in:
2024-09-01 21:50:34 +02:00
parent 210f69341b
commit a02ad89612
9 changed files with 161 additions and 0 deletions

1
crypto/caesar/ciphertext Normal file
View File

@@ -0,0 +1 @@
picoCTF{dspttjohuifsvcjdpoabrkttds}

16
crypto/caesar/solve.py Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p python3
def decrypt(ciphertext: str, key: int):
for letter in ciphertext:
shifted = chr(((ord(letter) - ord('a') + key + 26) % 26) + ord('a'))
print(shifted, end='')
print()
if __name__ == "__main__":
with open('ciphertext') as file:
enc = file.read().strip()[len('picoCTF{'):-len('}')]
# Note: seems to be the last one, "crossing the rubicon"
for shift in range(26):
decrypt(enc, shift)