crypto: add already solved challenges
This commit is contained in:
1
crypto/caesar/ciphertext
Normal file
1
crypto/caesar/ciphertext
Normal file
@@ -0,0 +1 @@
|
||||
picoCTF{dspttjohuifsvcjdpoabrkttds}
|
16
crypto/caesar/solve.py
Executable file
16
crypto/caesar/solve.py
Executable 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)
|
Reference in New Issue
Block a user