0.1.1 • Published 5 years ago

@nfen/xor v0.1.1

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

codecov npm version

Simple XOR module

Small module for running strings through a XOR cipher

Basic encryption and decryption example

const { toChar, xorStrings } = require( '@nfen/xor' );

function encrypt( key, clearText ) {
    return toChar( xorStrings( key, clearText ) );
}

function decrypt( key, cipherText ) {
    return toChar( xorStrings( key, cipherText ) );
}

console.assert(
    decrypt( 'whatever', encrypt( 'whatever', 'what is this sentence huh' ) ) === 'what is this sentence huh'
);