Skip to content

Instantly share code, notes, and snippets.

@JJ
Created January 6, 2017 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JJ/9953ba0a98800fed205eaae5b5a6410a to your computer and use it in GitHub Desktop.
Save JJ/9953ba0a98800fed205eaae5b5a6410a to your computer and use it in GitHub Desktop.
Perl6 one liners vol. 3: a very simple cypher
# This cypher applies character displacement to a set of letters using a "cypher" both users must have
perl6 -e "say (<1 -1 3 -3 4> <<+<< <t h i s i s s o s 1 k r i t>.map: {.ord}).map: {.chr}"
# In this case, the cypher is <1 -1 3 -3 4> and will be applied to the message after <<+<<
# You can retrieve the original message by applying the inverse of the cypher
perl6 -e "say (<-1 1 -3 3 -4> <<+<< <u g l p m t r r p 5 l q l q>.map: {.ord}).map: {.chr}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment