hex-xor-cipher
xor cipher for shift base encrypting and decrypting hexadecimal string
Adds an extra layer of protection to your already encrypted code's hex output by essentially turning it into nothing but valid hex.
Installation
demo: https://angeal185.github.io/hex-xor-cipher/
npm
$ npm install hex-xor-cipher --save
bower
$ bower install hex-xor-cipher --save
git
$ git clone git@github.com:angeal185/hex-xor-cipher.git
nodejs
const hx =
browser
info
- Adds a shif-based hex-xor to a valid hex string
000000
with a shift value of1
would become1f1f1f
000000
with a shift value of2
would become2e2e2e
000000
with a shift value of1
and{reverse: true}
would becomef1f1f1
000000
with a shift value of1
and{uppercase: true}
would becomeF1F1F1
000000
with a shift value of1
and{buff: [1,2]}
might become73f1f1f1c48e
API
//default options reverse: false // {boolean} ~ reverse hex string uppercase: false // {boolean} ~ output uppercase hex buff: false // {boolean/array} ~ prepend/append random hex buffer /** reverse should be set to either true or false for both encrypt/decrypt ~ default: false * buff accepts either a boolean for false or an array for true. ~ [1,2] would prepend/slice 1 byte(2 hex chars) to the start and append/slice 2 bytes(4 hex chars) of random data to the end*/ /** * callback * htc.enc(hex, key, config, cb) / htc.dec(hex, key, config, cb) * @param * @param * @param * @param **/ hx //returns callbackhx //returns callback /** * sync * htc.encSync(hex, key, config) * @param * @param * @param **/ hx //returns a stringhx //returns a string /** * promise * hx.encP(testStr, shift) / hx.decP(testStr, shift) * @param * @param * @param **/ hx //returns a promisehx //returns a promise // democonst testStr = '01234567890abcdef'shift = 1config = reverse: true uppercase: true buff: 24/* callback *///encrypthx/* end callback */ /* sync */// encryptlet encSync = hx// decryptdecSync = hx;consoleconsole/* end sync */ /* promise *///encrypthx;/* end promise */