Affine Cipher:
$Enc(x) = (ax + b) \mod m$
$Dec(x) = a^{-1}(x-b) \mod m$
For a brute-force key search, we need to do $a \cdot b$ encryptions in the worst case.
For a meet-in-the-middle attack, how many encryptions/decryptions do we need to do in the worse case?
Meet-in-the-middle attack definition: Affine cipher can be broken up into two separate encryptions and decryptions.
$Enc(x) = (ax)\mod m = c_1$
$Enc(c_1) = (c_1 + b) \mod m = c_2$
$Dec(c_2) = (x-b) \mod m = c_1$
$Dec(c_1) = a^{-1}(c_1) \mod m = x$
Now you can start by encryption x over all possible values of $a$ and decrypt $c_2$ over all possible values of $b$ then compare the two tables and find a match over $c_1$
Which now I realize has answered my question that it uses $a + b$ encryptions.
Side question: How is $a^{-1}$ calculated? $m - a = a^{-1}$ or maybe $m - a \mod m = a^{-1}$