# Complexity of attacks on affine cipher

I am interested in the complexity of attacking affine ciphers under the following two scenarios

• during a Ciphertext only attack
• during a Chosen Plaintext attack

For an alphabet of size $m$, how many calls to the decryption function would it take to brute force the key under each attack scenario?

If the multiplication is a matrix operation (or an extension field), then it's slightly less trivial. In this case, if the size of the alphabet $M$ has a prime factorization $p_1^{e_1}p_2^{e_2}...p_n^{e_n}$, then the total number of chosen plaintexts required during a chosen plaintext attack is $1 + max(e_0, e_1, ..., e_n)$. (Of course, if it's an extension field, then $n=1$)