ROT13 Class
The ROT13 Cipher is a monoalphabetic substitution cipher rotating A..Z
and a..z
characters.
Examples using static factory methods:
ROT13.Cipher().crypt('ABCDEFGHIJKLMNOPQRSTUVWXYZ'); // returns: 'NOPQRSTUVWXYZABCDEFGHIJKLM'
ROT13.Decipher().crypt('NOPQRSTUVWXYZABCDEFGHIJKLM'); // returns: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
Examples using constructors:
new ROT13().crypt('ABCDEFGHIJKLMNOPQRSTUVWXYZ'); // returns: 'NOPQRSTUVWXYZABCDEFGHIJKLM'
new ROT13().crypt('NOPQRSTUVWXYZABCDEFGHIJKLM'); // returns: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
See Wikipedia for details.
Constructor
ROT13
()
Item Index
Methods
- _substituteCharCode
- Cipher static
- crypt
- Decipher static
Methods
_substituteCharCode
(
Number
protected
-
charCode
Substitutes only charCodes of A..Z
and a..z
characters.
Parameters:
-
charCode
Numberthe charCode to substitute.
Returns:
Number:
The substituted charCode.
Cipher
()
ROT13
static
Static factory method to create cipher instances.
Returns:
ROT13:
The Cipher.