@basekits/kit-node-hashing

1.0.1 • Public • Published

@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') // returns 'e1f301ea36789e07a445c6341bd88cbd'

.hashFile(filepath, algorithm = 'md5')

Returns hash of a file.

kit.hashFile('/path/to/somefile.txt') // returns 'e1f301ea36789e07a445c6341bd88cbd'

.hashcode(str)

Java's hashcode implementation in javascript. (Credits goes to: stackoverflow.com) Returns positive or negative number.

kit.hashcode('hello') // returns 99162322
kit.hashcode('lorem ipsum') // returns -2126368101

Package Sidebar

Install

npm i @basekits/kit-node-hashing

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

6.6 kB

Total Files

9

Last publish

Collaborators

  • npm-support