caesar-salad

API Docs for: v2.0.1
Show:

ROT18 Class

Defined in: rot18.js:8
Module: caesar-salad

The ROT18 Cipher is a monoalphabetic substitution cipher combining ROT13 and ROT5.

Examples using static factory methods:

ROT18.Cipher().crypt('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789');   // returns: 'NOPQRSTUVWXYZABCDEFGHIJKLM5678901234'
ROT18.Decipher().crypt('NOPQRSTUVWXYZABCDEFGHIJKLM5678901234'); // returns: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'

Examples using constructors:

new ROT18().crypt('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789');       // returns: 'NOPQRSTUVWXYZABCDEFGHIJKLM5678901234'
new ROT18().crypt('NOPQRSTUVWXYZABCDEFGHIJKLM5678901234');       // returns: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'

See Wikipedia for details.

Constructor

ROT18

()

Defined in rot18.js:8

Item Index

Methods

Methods

_substituteCharCode

(
  • charCode
)
Number protected

Inherited from SubstitutionCipher but overwritten in rot18.js:28

Substitutes only charCodes of A..Z, a..z and '0..9' characters.

Parameters:

  • charCode Number

    the charCode to substitute.

Returns:

Number:

The substituted charCode.

Cipher

() ROT18 static

Defined in rot18.js:44

Static factory method to create cipher instances.

Returns:

ROT18:

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

() ROT18 static

Defined in rot18.js:55

Static factory method to create decipher instances.

Returns:

ROT18:

The Decipher.