Small module for running strings through a XOR cipher
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'
);