{"id":16416589,"url":"https://github.com/angeal185/hex-permutation-cipher","last_synced_at":"2026-05-16T04:11:04.000Z","repository":{"id":57263053,"uuid":"184416676","full_name":"angeal185/hex-permutation-cipher","owner":"angeal185","description":"permutation cipher for encrypting and decrypting a hexadecimal string","archived":false,"fork":false,"pushed_at":"2019-05-01T19:31:23.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-06T18:13:03.473Z","etag":null,"topics":["cipher","decrypt","encrypt","hex","hexadecimal","permutation","permutation-algorithms","permutation-cipher"],"latest_commit_sha":null,"homepage":"https://angeal185.github.io/hex-permutation-cipher","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/angeal185.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-01T13:00:19.000Z","updated_at":"2019-05-01T19:27:27.000Z","dependencies_parsed_at":"2022-08-31T00:01:49.104Z","dependency_job_id":null,"html_url":"https://github.com/angeal185/hex-permutation-cipher","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angeal185%2Fhex-permutation-cipher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angeal185%2Fhex-permutation-cipher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angeal185%2Fhex-permutation-cipher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angeal185%2Fhex-permutation-cipher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/angeal185","download_url":"https://codeload.github.com/angeal185/hex-permutation-cipher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240466791,"owners_count":19805862,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cipher","decrypt","encrypt","hex","hexadecimal","permutation","permutation-algorithms","permutation-cipher"],"created_at":"2024-10-11T07:09:38.164Z","updated_at":"2026-05-16T04:10:58.945Z","avatar_url":"https://github.com/angeal185.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hex-permutation-cipher\npermutation cipher for encrypting and decrypting a hexadecimal string\n\nAdds an extra layer of protection to your already encrypted code's hex output by essentially turning it into nothing but valid hex.\n\ndemo: https://angeal185.github.io/hex-permutation-cipher/\n\n### Installation\n\nnpm\n\n```sh\n$ npm install hex-permutation-cipher --save\n```\n\nbower\n\n```sh\n$ bower install hex-permutation-cipher\n```\n\ngit\n```sh\n$ git clone git@github.com:angeal185/hex-permutation-cipher.git\n```\n### nodejs\n\n```js\nconst per = require('hex-permutation-cipher')\n```\n\n#### browser\n\n```html\n\u003cscript src=\"./dist/hex-permutation.min.js\"\u003e\u003c/script\u003e\n```\n\n#### info\n* each hex character in the string is replaced with another random hex\n  character and returns a decrypt key the same length as the string.\n* padding can be added to the ciphertext output by using the buff option\n* the encrypt function returns the generated key. dont lose it.\n\n#### API\n\n```js\n//default options\n{\n    reverse: false, // {boolean} ~ reverse hex string\n    lower: false, //  {boolean} ~ output lowercase hex\n    buff: false //  {boolean/array} ~ prepend/append random hex buffer  \n}\n/*\n* reverse should be set to either true or false for both\n  encrypt/decrypt ~ default: false\n\n* buff accepts either a boolean for false or an array for true.\n  ~ [1,2] would prepend/slice 1 byte(2 hex chars) to the start\n    and append/slice 2 bytes(4 hex chars) of random data to the end.\n    this should not be left as false!\n*/\n\n/**\n *  callback\n *  @param {string} hex ~ valid hex string\n *  @param {integer} iterations\n *  @param {object} config ~ optional options\n *  @param {function} cb ~ callback function(err,data)\n **/\nper.enc(hex, iterations, config, cb) //returns callback\n\n/**\n *  callback\n *  @param {string} hex ~ valid hex string\n *  @param {string} key ~ decryption key\n *  @param {integer} iterations\n *  @param {object} config ~ optional options\n *  @param {function} cb ~ callback function(err,data)\n **/\nper.dec(hex, key, iterations, config, cb) //returns callback\n\n/**\n *  sync\n *  @param {string} hex ~ valid hex string\n *  @param {integer} iterations ~ integer\n *  @param {object} config ~ optional options\n **/\nper.encSync(hex, iterations, config) //returns a string\n\n/**\n *  sync\n *  @param {string} hex ~ valid hex string\n *  @param {string} key ~ decryption key\n *  @param {integer} iterations ~ integer\n *  @param {object} config ~ optional options\n **/\nper.decSync(hex, key, iterations, config) //returns a string\n\n/**\n *  promise\n *  @param {string} hex ~ valid hex string\n *  @param {integer} iterations ~ integer\n *  @param {object} config ~ optional options\n **/\nper.encP(hex, iterations, config) //returns a promise\n\n/**\n *  promise\n *  @param {string} hex ~ valid hex string\n *  @param {string} key ~ decryption key\n *  @param {integer} iterations ~ integer\n *  @param {object} config ~ optional options\n **/\nper.decP(hex, key, iterations, config) //returns a promise\n\n// demo\nconst testHexStr = 'ABCDEF0123456789',\nconfig = {\n    reverse: true,\n    lower: true,\n    buff: [2,4]\n}\n/* callback */\n//encrypt\nper.enc(testHexStr, 8, config, function(err, res){\n  if(err){return console.log(err)}\n  console.log(res)\n  //decrypt\n  per.dec(res.data, res.key, res.iterations, config, function(err, res){\n    if(err){return console.log(err)}\n    console.log(res)\n  })\n})\n/* end callback */\n\n/* sync */\n// encrypt\nlet syncEnc = per.encSync(testHexStr, 8, config);\nconsole.log(syncEnc)\n// decrypt\nlet syncDec = per.decSync(syncEnc.data, syncEnc.key, syncEnc.iterations, config)\nconsole.log(syncDec)\n/* end sync */\n\n/* promise */\n//encrypt\nper.encP(testHexStr, 8, config).then(function(res){\n  console.log(res)\n  //decrypt\n  per.decP(res.data, res.key, res.iterations, config).then(function(res){\n    console.log(res)\n  }).catch(function(err){\n    console.log(err)\n  })\n}).catch(function(err){\n  console.log(err)\n})\n/* end promise */\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangeal185%2Fhex-permutation-cipher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangeal185%2Fhex-permutation-cipher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangeal185%2Fhex-permutation-cipher/lists"}