1.0.0 • Published 5 years ago

@haydenhigg/affine v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

@haydenhigg/affine

A small library for affine encryption. Ideal behavior taken from here, other source is here.

Usage

const affine = require("@haydenhigg/affine");

let a = 5; // multiplicand
let b = 8; // addend

var encrypted = affine.encrypt(a, b, "the message");
var decrypted = affine.decrypt(a, b, encrypted);

console.log(encrypted); // "ZRC QCUUIMC"
console.log(decrypted); // "THE MESSAGE"

var encryptedWithKey = affine.encrypt(a, b, "the message", "the key");
var decryptedWithKey = affine.decrypt(a, b, encryptedWithKey, "the key");

console.log(encryptedWithKey); // "ZPE OESSDJE"
console.log(decryptedWithKey); // "THE MESSAGE"