From d73413f568fc9ec69a3a6433ffe1e0d5809f165a Mon Sep 17 00:00:00 2001 From: Reaper Gelera Date: Sun, 12 Nov 2023 23:57:24 +0530 Subject: [PATCH] paperwork --- README.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 82df9bb..9ec7bd6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,50 @@ -# @dumbjs/quick-hash +![dumbjs/quick-hash](https://socialify.git.ci/dumbjs/quick-hash/image?description=1&name=1&owner=1&pattern=Solid&theme=Dark) -> Quick non-cryptographic hash functions for strings +# Why? + +Tired of copying them around + +# Usage + +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`) + +### dbj2 + +[Details →](http://www.cse.yorku.ca/~oz/hash.html#djb2) + +```js +import { dbj2 as hash } from '@dumbjs/quick-hash' +// or +// import { dbj2 as hash } from '@dumbjs/quick-hash/dbj2' + +hash('hello') //=>261238937 +``` + +### sdbm + +[Details →](http://www.cse.yorku.ca/~oz/hash.html#sdbm) + +#### 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 +``` ## License