r/codegolf • • Jun 01 '14

[perl] Reversible Substitution Algorithm

I propose a new challenge.

write a program in the shorted amount of characters which:

  1. Takes an input string

  2. Performs 3 different substitution on the string (swapping every two characters, reversing the string, replacing all characters with equivalent hex values, etc, be creative)

  3. Perform a 1/2 rotation substitution. Essentially each letter maps to the 13 letter over in the alphabet

  4. The algorithm must be reversible. Meaning I enter a string like "hello" and get some nonsense like "ryubb", and when I make "ryubb" the input I should get "hello".

1 Upvotes

3 comments sorted by

View all comments

Show parent comment

1

u/autowikibot Jun 01 '14

Involution (mathematics):


In mathematics, an (anti-)involution, or an involutary function, is a [function](https://en.wikipedia.org/wiki/Function_(mathematics)) f that is its own inverse,

====

Image i - An involution is a function that, when applied twice, brings one back to the starting point.


Interesting: Semigroup with ^involution | Telephone number ^(mathematics) | Fricke ^involution | Rosati ^involution

Parent commenter can toggle ^NSFW or ^delete. Will also delete on comment score of -1 or less. | FAQs | ^Mods | Magic ^Words