{"_id":"custom-hash","_rev":"5-48f4649d01c34e07ff3f971661e2444d","name":"custom-hash","time":{"modified":"2022-06-14T06:14:28.864Z","created":"2015-12-24T12:26:32.457Z","0.8.0":"2015-12-24T12:26:32.457Z","0.9.0":"2015-12-24T13:05:59.494Z"},"maintainers":[{"name":"belema","email":"belema.gancarz@gmail.com"}],"dist-tags":{"latest":"0.9.0"},"description":"Custom hash generator (based on MD5 algorithm)","readme":"custom-hash [![Build Status](https://travis-ci.org/Belema/custom-hash.svg?branch=master)](https://travis-ci.org/Belema/custom-hash)\r\n===========\r\n\r\ncustom-hash lets you create (very) customisable hashes of 128 bits or less.\r\n\r\nMain use case\r\n-------------\r\nDeterministically creating a hash of a limited length, using a defined set of characters.\r\n\r\n\tvar hash = require('custom-hash');\r\n\thash.configure({ charSet: [ 'A', 'B', 'C', 'D', 'E', 'F' ], maxLength: 10 });\r\n\r\n\thash.digest('Hello World');\r\n\t-> 'BECFBFECAD'\r\n\r\n\thash.digest('Hello World!');\r\n\t-> 'CCABBACAEE'\r\n\r\nConfiguration\r\n-------------\r\nWithout customisation, custom-hash is just an inefficient way of generating an MD5 hash. \r\n\r\n\thash.digest('Hello World!');\r\n\t-> 'ed076287532e86365e841e92bfc50d8c'\r\n\r\nConverting the MD5 hash to a different base is done by changing the number of characters in the `charSet` config property.\r\n\r\n\thash.configure({ charSet: [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' ] });\r\n\thash.digest('Hello World!');\r\n\t-> '315065379476721403163906509030895717772'\r\n \r\nShortening the output is achieved by decreasing the value of the `maxLength` config property.\r\n\r\n\thash.configure({ maxLength: 10 });\r\n\thash.digest('Hello World!');\r\n\t-> 'ed07628753'\r\n\r\nChoosing the part of the hash to use is achieved by setting `right` to `true` in the config.\r\n\r\n\thash.configure({ right: true, maxLength: 10 });\r\n\thash.digest('Hello World!');\r\n\t-> '92bfc50d8c'\r\n\r\nDefault config values\r\n---------------------\r\n\r\nThey are,\r\n\r\n\tvar DEFAULTS = {\r\n\t    charSet: [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' ],\r\n\t    maxLength: 128,\r\n\t    right: false\r\n\t};\r\n\r\nA parameterless call to the function `configure` resets the configuration to its default values.\r\n \r\n\tvar hash = require('custom-hash');\r\n\thash.configure();\r\n\r\nContributing\r\n-------------\r\nPlease run the following commands before submitting a pull-request,\r\n\r\n\tnpm run lint\r\n\tnpm run code-style\r\n\tnpm run test\r\n","versions":{"0.9.0":{"name":"custom-hash","version":"0.9.0","description":"Custom hash generator (based on MD5 algorithm)","main":"lib/custom-hash.js","scripts":{"lint":"jshint ./ --exclude ./node_modules","code-style":"jscs ./","test":"mocha tests --require should --reporter spec --colors"},"repository":{"type":"git","url":"git+https://github.com/Belema/custom-hash.git"},"keywords":["hash","custom","md5","short","short-hash","custom-md5","short-md5"],"author":{"name":"Belema Gancarz"},"license":"MIT","bugs":{"url":"https://github.com/Belema/custom-hash/issues"},"homepage":"https://github.com/Belema/custom-hash#readme","devDependencies":{"jscs":"^2.7.0","jshint":"^2.8.0","mocha":"^2.3.4","should":"^8.0.2"},"gitHead":"b838e3b9aad799220b2aeb30e68f1027dbeef5c6","_id":"custom-hash@0.9.0","_shasum":"58823c0ea1fa170026f857ac4ba208b7fc259ca2","_from":".","_npmVersion":"2.12.1","_nodeVersion":"0.10.37","_npmUser":{"name":"belema","email":"belema.gancarz@gmail.com"},"dist":{"shasum":"58823c0ea1fa170026f857ac4ba208b7fc259ca2","tarball":"https://registry.npmjs.org/custom-hash/-/custom-hash-0.9.0.tgz","integrity":"sha512-sUpEGIe7sxB3o2CkmJ+ebC/nz8y7udCQBAw/FBBKVd4/hsfZtksJ7t1NpajCe25Z5eFUTY7HGAbuUnGB5dfldw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBBUY4mXG2ycLAhe0qWt3jMPBV5Wkwn3ck+PrJ2H2NcqAiAGT4YVdFN5L+oIXQ2zqFw0PA9tl0D4vlpZpSlU97qLrw=="}]},"maintainers":[{"name":"belema","email":"belema.gancarz@gmail.com"}]}},"homepage":"https://github.com/Belema/custom-hash#readme","keywords":["hash","custom","md5","short","short-hash","custom-md5","short-md5"],"repository":{"type":"git","url":"git+https://github.com/Belema/custom-hash.git"},"author":{"name":"Belema Gancarz"},"bugs":{"url":"https://github.com/Belema/custom-hash/issues"},"license":"MIT","readmeFilename":"README.md"}