we can represent replacement rule using another string to describe the translation as concrete examplesuppose we are using caesar cipher with threecharacter rotation we can precompute string that represents the replacements that should be used for each character from to for examplea should be replaced by db replaced by eand so on the replacement characters in order are defghijklmnopqrstuvwxyzabc we can subsequently use this translation string as guide to encrypt message the remaining challenge is how to quickly locate the replacement for each character of the original message fortunatelywe can rely on the fact that characters are represented in unicode by integer code pointsand the code points for the uppercase letters of the latin alphabet are consecutive (for simplicitywe restrict our encryption to uppercase letterspython supports functions that convert between integer code points and one-character strings specificallythe function ord(ctakes one-character string as parameter and returns the integer code point for that character converselythe function chr(jtakes an integer and returns its associated one-character string in order to find replacement for character in our caesar cipherwe need to map the characters to to the respective numbers to the formula for doing that conversion is ord(corda as sanity checkif character is we have that when is we will find that its ordinal value is precisely one more than that for so their difference is in generalthe integer that results from such calculation can be used as an index into our precomputed translation stringas illustrated in figure encoder array using as an index in unicode ordt orda here is the replacement for figure illustrating the use of uppercase characters as indicesin this case to perform the replacement rule for caesar cipher encryption in code fragment we develop python class for performing the caesar cipher with an arbitrary rotational shiftand demonstrate its use when we run this program (to perform simple test)we get the following output secretwkh hdjoh lv lq sodbphhw dw mrh' messagethe eagle is in playmeet at joe' the constructor for the class builds the forward and backward translation strings for the given rotation with those in handthe encryption and decryption algorithms are essentially the sameand so we perform both by means of nonpublic utility method named transform