ROT47 Class
The ROT47 Cipher is a monoalphabetic substitution cipher rotating !..~
characters.
Examples using static factory methods:
ROT47.Cipher().crypt('!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~');
// returns: 'PQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO'
ROT47.Decipher().crypt('PQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO');
// returns: '!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'
Examples using constructors:
new ROT47().crypt('!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~');
// returns: 'PQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO'
new ROT47().crypt('PQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO');
// returns: '!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'
See Wikipedia for details.
Constructor
ROT47
()
Item Index
Methods
- _substituteCharCode
- Cipher static
- crypt
- Decipher static
Methods
_substituteCharCode
(
Number
protected
-
charCode
Substitutes only charCodes of !..~
characters.
Parameters:
-
charCode
Numberthe charCode to substitute.
Returns:
Number:
The substituted charCode.
Cipher
()
ROT47
static
Static factory method to create cipher instances.
Returns:
ROT47:
The Cipher.