這次比賽因為是戰隊辦的比賽所以我擔任出題者
來看看我出的題目的官方解吧 >W<
Secret Rot13
Open the two file
encrypte code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| def encrypt(text, key): encrypted_text = "" for i, char in enumerate(text): offset = ((i + 1 + key) * (i + 1)) % 26 if 'A' <= char <= 'Z': new_char = chr((ord(char) - ord('A') + offset) % 26 + ord('A')) elif 'a' <= char <= 'z': new_char = chr((ord(char) - ord('a') + offset) % 26 + ord('a')) else: new_char = char encrypted_text += new_char return encrypted_text
key = 7 plaintext = "NHNC{TEST}" ciphertext = encrypt(plaintext, key) print("加密後的密文:", ciphertext)
|
This code is let the word do ROT
so find read the code and write a code to decrypte
code for decrypte
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| def decrypt(encrypted_text, key): decrypted_text = "" for i, char in enumerate(encrypted_text): offset = ((i + 1 + key) * (i + 1)) % 26 if 'A' <= char <= 'Z': new_char = chr((ord(char) - ord('A') - offset + 26) % 26 + ord('A')) elif 'a' <= char <= 'z': new_char = chr((ord(char) - ord('a') - offset + 26) % 26 + ord('a')) else: new_char = char decrypted_text += new_char return decrypted_text
encrypted_text = "VZRU{Y0k_yd0w_Z0o_ti_rsslyxli}"
for key in range(26): decrypted_text = decrypt(encrypted_text, key) print(f"密鑰 {key}: {decrypted_text}")
|
AES?
open output.txt
1 2 3
| Enter IV: 1234567890987654 Secret Key: 1234567890987654 output: TkdU8sqjliuakA+nj2aEmbDf+AaJwASfPuooaKadCqg=
|
Is AES
Put it into an online decrypter
The flag:
Flag: NHNC{Y0u_kn0w_AES}