Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
custom-hash
Advanced tools
custom-hash lets you create (very) customisable hashes of 128 bits or less.
Deterministically creating a hash of a limited length, using a defined set of characters.
var hash = require('custom-hash');
hash.configure({ charSet: [ 'A', 'B', 'C', 'D', 'E', 'F' ], maxLength: 10 });
hash.digest('Hello World');
-> 'BECFBFECAD'
hash.digest('Hello World!');
-> 'CCABBACAEE'
Without customisation, custom-hash is just an inefficient way of generating an MD5 hash.
hash.digest('Hello World!');
-> 'ed076287532e86365e841e92bfc50d8c'
Converting the MD5 hash to a different base is done by changing the number of characters in the charSet
config property.
hash.configure({ charSet: [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' ] });
hash.digest('Hello World!');
-> '315065379476721403163906509030895717772'
Shortening the output is achieved by decreasing the value of the maxLength
config property.
hash.configure({ maxLength: 10 });
hash.digest('Hello World!');
-> 'ed07628753'
Choosing the part of the hash to use is achieved by setting right
to true
in the config.
hash.configure({ right: true, maxLength: 10 });
hash.digest('Hello World!');
-> '92bfc50d8c'
They are,
var DEFAULTS = {
charSet: [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' ],
maxLength: 128,
right: false
};
A parameterless call to the function configure
resets the configuration to its default values.
var hash = require('custom-hash');
hash.configure();
Please run the following commands before submitting a pull-request,
npm run lint
npm run code-style
npm run test
FAQs
Custom hash generator (based on MD5 algorithm)
We found that custom-hash demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.