Keyword Alphabet Mapping Code
This code simply maps each letter of the alphabet onto another letter using a keyword. to work out what letter is used for each mapping the keyword is first written (removing any duplicate letters) followed by the remaining letters of the alphabet in order, giving a 26 letter sequence which is used to map the 26 letters of the alphabet. Non alphabetic characters are left unchanged.
For example, if the keyword was 'herbert', the letters 'herbt' would be written (ignoring the duplicate 'e' and 'r') followed by the remaining letters in order, i.e. 'acdfgijklmnopqsuvwxyz', giving 'herbtacdfgijklmnopqsuvwxyz'. We now have a one to one mapping from abcdefghijklmnopqrstuvwxyz to herbtacdfgijklmnopqsuvwxyz, so 'a' becomes 'h', 'b' becomes 'e', ... 'f' becomes 'a', 'g' becomes 'c', etc.