rot13

rot13, function

def pure rot13(input: text): text

Applies the ROT13 text transformation to Latin alphabet letters in 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("test_7") as "test_7"

This outputs the following summary:

ABEFH abefh BA-B3 ABA:A test_7
NORSU norsu ON-O8 NON:N grfg_2

Remarks

The function is intended to mildly obfuscate text while preserving its overall shape (uppercase stays uppercase, lowercase stays lowercase, digits remain digits). It is not a secure pseudonymization method.

The only affected characters are uppercase Latin letters ABCDEFGHIJKLMNOPQRSTUVWXYZ, lowercase Latin letters abcdefghijklmnopqrstuvwxyz, and digits 0123456789.

User Contributed Notes
0 notes + add a note