CryptographyLevel 2★★☆☆☆50 pts

Cryptanalysis - Breaking the Affine Cipher
Missionciphertext.txt is an English report encrypted with the affine cipher E(x) = (a*x + b) mod 26. Letter case is preserved and non-letters are unchanged. Use the fact that the plaintext begins with the word KINOCO to recover the keys a and b, decrypt the report and submit the flag on the last line.
Hints
Hint 1Show
The first six letters of the ciphertext correspond to KINOCO. Convert letters to numbers such as K=10 and N=13
Hint 2Show
Subtracting a*10+b ≡ c1 and a*13+b ≡ c2 (mod 26) gives 3a ≡ c2-c1. There are only 12 choices for a and 26 for b, so brute force also works
Hint 3Show
Decrypt with D(y) = a^-1 * (y - b) mod 26. Compute a^-1 with pow(a, -1, 26)