caesar-salad

API Docs for: v2.0.1
Show:

ROT13 Class

Defined in: rot13.js:5
Module: caesar-salad

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

()

Defined in rot13.js:5

Item Index

Methods

Methods

_substituteCharCode

(
  • charCode
)
Number protected

Inherited from SubstitutionCipher but overwritten in rot13.js:25

Substitutes only charCodes of A..Z and a..z characters.

Parameters:

  • charCode Number

    the charCode to substitute.

Returns:

Number:

The substituted charCode.

Cipher

() ROT13 static

Defined in rot13.js:48

Static factory method to create cipher instances.

Returns:

ROT13:

The Cipher.

crypt

(
  • input
)
Number
Template method to encrypt/decrypt strings substituting its input charCode by charCode.

Parameters:

  • input String
    The string to process.

Returns:

Number: The processed string.

Decipher

() ROT13 static

Defined in rot13.js:59

Static factory method to create decipher instances.

Returns:

ROT13:

The Decipher.