The affine cipher is a type of monoalphabetic substitution cipher , wherein each letter in an alphabet is mapped to its numeric equivalent, encrypted using a simple mathematical function, and converted back to a letter. The formula used means that each letter encrypts to one other letter, and back again, meaning the cipher is essentially a standard substitution cipher with a rule governing which letter goes to which. As such, it has the weaknesses of all substitution ciphers. Each letter is enciphered with the function , where is the magnitude of the shift. For more information on affine cipher visit here Following code is written in c# which has the affine cipher algorithm public static string AffineEncrypt( string plainText, int a, int b) { string cipherText = "" ; // Put Plain Text (all capitals) into Character Array char [] chars = plainText.ToUpper().ToCharArray(); // Compute e(x) = (ax + b)(mod m) ...
Comments
Post a Comment