Javascript implementation of simple Ciphers
Install the package using yarn:
$ yarn add cipherjsor npm:
$ npm install --save cipherjsStart by require-ing the module:
const CipherJS = require('cipherjs');It returns an Object of available ciphers, each with their own encrypt and
decrypt methods:
CipherJS.Vigenere.encrypt('MY SECRET MESSAGE', 'MY SECRET KEY')
// YW KIEIIM WIQEYYIcipherjs comes with a CLI app that lets you encrypt or decrypt data interactively.
To use it, install the package globally:
$ npm install -g cipherjsand just execute cipherjs in your terminal:
$ cipherjsAll Ciphers have one encrypt and decrypt method, with the first argument as the
ciphertext / plaintext.
Takes two numeric keys, the first of which should be a coprime with 26 and the
second should be between 0-25:
CipherJS.Affine.encrypt('AFFINE CIPHER', 5, 23)
// 'XWWLKR HLUGRE'
CipherJS.Affine.decrypt('XWWLKR HLUGRE', 5, 23)
// 'AFFINE CIPHER'Takes one numeric key along with the plaintext / ciphertext:
CipherJS.Caesar.encrypt('CAESAR CIPHER', 13)
// 'PNRFNE PVCURE'
CipherJS.Caesar.decrypt('PNRFNE PVCURE', 13)
// 'CAESAR CIPHER'Takes only a string key for encoding and decoding:
CipherJS.Substitution.encrypt('SIMPLE SUBSTITUTION CIPHER', 'SECRET KEY')
// 'OBHLGT OQEOPBPQPBJI CBLATN'
CipherJS.Substitution.decrypt('OBHLGT OQEOPBPQPBJI CBLATN', 'SECRET KEY')
// 'SIMPLE SUBSTITUTION CIPHER'Takes only a string key for encoding and decoding:
CipherJS.Vigenere.encrypt('VIGENERE CIPHER', 'ANOTHER SECRET KEY')
// 'VVUXUIIW GKGLXB'
CipherJS.Vigenere.decrypt('VVUXUIIW GKGLXB', 'ANOTHER SECRET KEY')
// 'VIGENERE CIPHER'- Fork, Enhance, Send PR
- Lock issues with any bugs or feature requests
- Implement something from Roadmap
- Spread the word
This package is available as open source under the terms of the MIT License.

