@basekits/kit-node-hashing
Hash functions kit for basekits and node runtime.
Install
npm i @basekits/kit-node-hashing
Usage
const kit = require('@basekits/core')
const hashing = require('@basekits/kit-node-hashing')
kit.addKit(hashing)
Available Items
The following methods will be available after adding this kit:
.hash(data, algorithm = 'md5')
Returns hash of some data. data
can be anything which node's crypto library accepts.
kit.hash('asdfghjklşi')
.hashFile(filepath, algorithm = 'md5')
Returns hash of a file.
kit.hashFile('/path/to/somefile.txt')
.hashcode(str)
Java's hashcode implementation in javascript. (Credits goes to: stackoverflow.com) Returns positive or negative number.
kit.hashcode('hello')
kit.hashcode('lorem ipsum')