Skip to content

Commit

Permalink
paperwork
Browse files Browse the repository at this point in the history
  • Loading branch information
barelyhuman committed Nov 12, 2023
1 parent 960d354 commit d73413f
Showing 1 changed file with 46 additions and 2 deletions.
48 changes: 46 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit d73413f

Please sign in to comment.