Affine Cipher

The Affine cipher is a monoalphabetic cipher, meaning that it uses the same substitution for each character in the message.

The encrypt goes through each letter and does (letter*a + b) mod 26. There are only 12 values for a because a must be coprime with 26 (the modular multiplicative inverse of a modulus 26 is calculated), but there are 26 value for b. The decrypt does this in reverse. The brute force goes through all 312 possibilities.