rot13

rot13, function

def pure rot13(input: text): text

Applies the ROT13 text transformation to latin alphabet letters in its input, and ROT5 to digits. Other characters are left unchanged.

Example

show summary "rot13" with 
  rot13("ABEFH") as "ABEFH"
  rot13("abefh") as "abefh"
  rot13("BA-B3") as "BA-B3"
  rot13("ABA:A") as "ABA:A"
  rot13("t€s_t") as "t€s_t"

This outputs the following summary:

Label Value
ABEFH NORSU
abefh norsu
BA-B3 ON-O8
ABA:A NON:N
t€s_t g€f_g

Remarks

The function rot13 is intended to be used to slightly obfuscate text in a way that preserves its overall shape (uppercase stays uppercase, lowercase stays lowercase, and digits remain digits). It is not a viable form of pseudonymization (since the original value can be easily retrieved).

The function has the following useful properties:

The only characters affected are uppercase latin letters ABCDEFGHIJKLMNOPQRSTUVWXYZ, lowercase latin letters abcdefghijklmnopqrstuvwxyz, and digits 0123456789. All other characters (including other alphabets, and letters with diacritics such as ü or é) are left unchanged.

User Contributed Notes
0 notes + add a note