The forward transformations are a straightforward. The trickiest reverse implementation is the rotation based on the index of the letter.