0.0.3 • Published 4 years ago

cryptonode.js v0.0.3

Weekly downloads
4
License
ISC
Repository
github
Last release
4 years ago

CryptoNode.JS

Description

Cryptonode.js is a simple library cryptography for NodeJS

Installation

npm i cryptonode.js

Table of Contents

List Crypto

Caesar Cipher

Description

Sample

const c = new Crypto;

console.log(c.caesar("e", "Defri Indra Mahardika", 3));
console.log(c.caesar("d", "Ghiul Lqgud Pdkduglnd", 3));

// Output : 
// Ghiul Lqgud Pdkduglnd
// Defri Indra Mahardika

Morse

Description

Sample

const c = new Crypto;

console.log(c.morse("e", "defri indra mahardika", {
    short: "+"
}));

// Output : 
// -++ + ++-+ +-+ ++ / ++ -+ -++ +-+ +- / -- +- ++++ +- +-+ -++ ++ -+- +-

ROT13

Description

Sample

const c = new Crypto;

console.log(c.rot13("defri indra mahardika"));

// Output : 
// qrsev vaqen znuneqvxn

NATO

Description

Sample

const c = new Crypto;

console.log(c.nato("e", "defri indra mahardika"));

// Output : 
// Delta Echo Foxtrot Romeo India(space) India November Delta Romeo Alfa(space) Mike Alfa Hotel Alfa Romeo Delta India Kilo Alfa

Affine Cipher

Description

Sample

const c = new Crypto;
let custom_letters = "OPQRSTUVWXYZABCDEFGHIJKLMN";
let ciphertext = "Iloyx Xmiyz Jzuzyixdz";
let plaintext = "Defri Indra Mahardika"
let key = [3, 1];

console.log(c.affine("e", plaintext, key, custom_letters));
console.log(c.affine("d", ciphertext, key, custom_letters));

// Output : 
// Delta Echo Foxtrot Romeo India(space) India November Delta Romeo Alfa(space) Mike Alfa Hotel Alfa Romeo Delta India Kilo Alfa

Vigenere Cipher

Description

Sample

const CryptoNode = require('cryptonode.js')

const c = new CryptoNode;
let plain_text = "Defri Indra Mahardika";
let cipher_text = "Svtxz Izhgr Agyadhxbo";
let key = "programe";

console.log(c.vigenere('e', plain_text, key));
console.log(c.vigenere('d', cipher_text, key));

// Output : 
// Svtxz Izhgr Agyadhxbo
// Defri Indra Mahardika

Base 64

Description

Sample

const CryptoNode = require('cryptonode.js');
const c = new CryptoNode;

c.b64("encode", "any carnal pleasu");
c.b64('e', "##Defri indra Mahardika*&^%`");

c.b64("d", "YW55IGNhcm5hbCBwbGVhc3U=");
c.b64('decode', "IyNEZWZyaSBpbmRyYSBNYWhhcmRpa2EqJl4lYA==");

// Output : 
// YW55IGNhcm5hbCBwbGVhc3U=
// IyNEZWZyaSBpbmRyYSBNYWhhcmRpa2EqJl4lYA==
// any carnal pleasu
// ##Defri indra Mahardika*&^%`