1.2.2 • Published 1 year ago

rotation-cipher v1.2.2

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Rotation Cipher 🗝️

A lightweight utility for performing caesar ciphers. This classic cipher shifts characters in a given string by a specified amount to provide a small layer of encryption.

Capable of creating ciphers containing characters in the english alphabet (a-zA-Z) and human-readable ASCII characters.

Use cases:

  • perform basic, custom, and randomized caesar ciphers
  • generate a cool username / social media handle

Installation

Install the package from npm:

npm install rotation-cipher

Create ciphers on the fly:

import { caesarCipher } from 'rotation-cipher';

console.log(caesarCipher('tanner', 21));
// oviizm

Example usage

Basic Cipher

Rotate each character by the default 13 characters:

console.log(caesarCipher('tanner'));
// gnaare

User defined uniform rotation

Rotate each character by a uniform rotation:

console.log(caesarCipher('tanner', 17));
// kreevi

User defined uniform rotation (with ASCII)

Rotate each character by a uniform rotation including ASCII:

console.log(caesarCipher('t@nn3r!', 15));
// i,cc}g0

Custom rotation array

Rotate each character by a specific rotation:

console.log(caesarCipher('tanner', 0, [3, 5, 1, 2, 7, 8]));
// wfoplz

Random rotation

Rotate each character by a random rotation:

import { caesarCipher, randomRotation } from 'rotation-cipher';

let s = 'tanner';
console.log(caesarCipher(s, 0, randomRotation(s)));

Resources

1.2.0

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago