caesar-salad

API Docs for: v2.0.1
Show:

ROT47 Class

Defined in: rot47.js:6
Module: caesar-salad

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

()

Defined in rot47.js:6

Item Index

Methods

Methods

_substituteCharCode

(
  • charCode
)
Number protected

Inherited from SubstitutionCipher but overwritten in rot47.js:32

Substitutes only charCodes of !..~ characters.

Parameters:

  • charCode Number

    the charCode to substitute.

Returns:

Number:

The substituted charCode.

Cipher

() ROT47 static

Defined in rot47.js:55

Static factory method to create cipher instances.

Returns:

ROT47:

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

() ROT47 static

Defined in rot47.js:66

Static factory method to create decipher instances.

Returns:

ROT47:

The Decipher.