hex-permutation-cipher
permutation cipher for encrypting and decrypting a 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.
demo: https://angeal185.github.io/hex-permutation-cipher/
Installation
npm
$ npm install hex-permutation-cipher --save
bower
$ bower install hex-permutation-cipher
git
$ git clone git@github.com:angeal185/hex-permutation-cipher.git
nodejs
const per =
browser
info
- each hex character in the string is replaced with another random hex character and returns a decrypt key the same length as the string.
- padding can be added to the ciphertext output by using the buff option
- the encrypt function returns the generated key. dont lose it.
API
//default options reverse: false // {boolean} ~ reverse hex string lower: false // {boolean} ~ output lowercase 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. this should not be left as false!*/ /** * callback * @param * @param * @param * @param **/per //returns callback /** * callback * @param * @param * @param * @param * @param **/per //returns callback /** * sync * @param * @param * @param **/per //returns a string /** * sync * @param * @param * @param * @param **/per //returns a string /** * promise * @param * @param * @param **/per //returns a promise /** * promise * @param * @param * @param * @param **/per //returns a promise // democonst testHexStr = 'ABCDEF0123456789'config = reverse: true lower: true buff: 24/* callback *///encryptper/* end callback */ /* sync */// encryptlet syncEnc = per;console// decryptlet syncDec = perconsole/* end sync */ /* promise *///encryptper/* end promise */