Quick non-cryptographic hash functions for strings
npm install @dumbjs/quick-hash- Why?
- Usage
- dbj2
- sdbm
- Original Version
- GAWK Version
- License
Tired of copying them around
The library exports a few quick string hashing functions that are widely used
for proper bit distribution and short hashes for longer strings, (with the
exception of the BigInt implementation of sdbm)
``js
import { djb2 as hash } from '@dumbjs/quick-hash'
// or
// import { djb2 as hash } from '@dumbjs/quick-hash/djb2'
hash('hello') //=>261238937
`
#### Original Version
`js
import { sdbm as hash } from '@dumbjs/quick-hash'
// or
// import { sdbm as hash } from '@dumbjs/quick-hash/sdbm'
hash('hello') //=>31334377934759990
`
#### GAWK Version
`js
import { sdbmGawk as hash } from '@dumbjs/quick-hash'
// or
// import { sdbmGawk as hash } from '@dumbjs/quick-hash/sdbm'
hash('hello') //=>1925877435333486942514
``