This is an Elixir implementation of a simple encoding algorithm called Crypto Square.
Just to make the implementation more "interesting" (i.e., needlessly complicated), I've split the parts of the algorithm across multiple Elixir processes :-)
mix test
iex -S mix
Note: this command executes the code in runner.ex
.
Source: slides from my YOW West 2015 presentation
All non alphanumberic characters are removed from the plain text.
The size of the "square" (normally a rectangle) is calculated based on the length of the normalised plaintext.
The normalised plaintext is arranged into a rectangular grid.
The ciphertext is formed by "reading" down each of the columns and joining the resultant columns together.
More details about the details of the algo can be found on Exercism.