← SPL reference

encrypt (lib/encrypt.py)

Not for cryptography or security. This pipeline is deterministic in structure but powered by pseudo-randomness; it hides text for fun/obfuscation only. Do not use for passwords, tokens, regulated data, or anything requiring confidentiality or integrity guarantees.

Load with explicit extension (reqFileExtension = True): use encrypt.py;

API

use encrypt.py;

t.setVar(encrypt.obfuscate("hello world"));
print.string(t);

Exact algorithm (encrypt.obfuscate)

  1. Whitespace strip. Drop every Unicode whitespace character (str.isspace()), including spaces and newlines—not only ASCII space U+0020. If the result is empty, return "" immediately. null/None argument returns null.
  2. Random casing. Independently per character: if char.isalpha(), flip case with probability 50%; otherwise leave unchanged.
  3. Character substitution (every surviving character). Translate all characters whose code points lie in this bidirectional mapping (others unchanged): 1↔l (also L→1), i↔! (I→!), e↔3 (E→3), 0↔o (O→0), S,s↔5, 5→S.
  4. Shuffle. Treat the current string as a list of characters and apply Fisher–Yates with Python’s standard random module (not cryptographically secure).
  5. Random punctuation inserts. Choose an insertion count count uniformly from randint(max(3, ⌊n/4⌋), max(6, ⌊n/2⌋+5)) where n is the string length before inserts. Repeat count times: pick random index from 0..len (inclusive insertion points) and splice in one symbol chosen uniformly from ?///\/"/'/!/./,/:/;/-/[/{/]/}/(/).
  6. Concatenated decimal ASCII ordinals. Emit ''.join(str(ord(ch)) for ch in …) with no separators: e.g. ab9798 (97 immediately followed by 98, not spaced). Non-ASCII code points lengthen the digits segment for that character; decoders cannot infer boundaries from spacing because there are none—this encoder is intentionally one-way for casual use only.

Implementation: someProgrammingLanguage/lib/encrypt.py · SPL reference row: encrypt.obfuscate(s)