# siphash24

> SipHash (2-4) implemented in pure Javascript and WebAssembly

Latest version **1.3.1** (published 2022-03-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install siphash24
pnpm add siphash24
yarn add siphash24
bun add siphash24
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2022-03-21 |
| First published | 2017-06-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 23.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 50 |
| Author | Mathias Buus |
| Maintainers | mafintosh |

## Links

- npm: https://www.npmjs.com/package/siphash24
- Repository: https://github.com/mafintosh/siphash24
- Issues: https://github.com/mafintosh/siphash24/issues
- npm.io page: https://npm.io/package/siphash24

## Dependencies (1)

- [nanoassert](https://npm.io/package/nanoassert.md) ^2.0.0

## Recent versions

- 1.3.1 (latest) — 2022-03-21
- 1.3.0 — 2021-11-22
- 1.2.0 — 2021-05-25
- 1.1.1 — 2018-06-05
- 1.1.0 — 2017-11-16
- 1.0.2 — 2017-06-17
- 1.0.1 — 2017-06-12
- 1.0.0 — 2017-06-12

## README

# siphash24

[SipHash](https://en.wikipedia.org/wiki/SipHash) (2-4) implemented in pure Javascript and WebAssembly.

```
npm install siphash24
```

The Javascript fallback is adapted from [https://github.com/jedisct1/siphash-js](https://github.com/jedisct1/siphash-js) to support Uint8Arrays
and the (fast!) WebAssembly implementation is hand written.

When using the WASM implementation this module is almost as fast as the C version (around 10% slower on my laptop).

## Usage

``` js
var siphash24 = require('siphash24')
var hash = siphash24(Buffer.from('hello world'), Buffer.from('012345678012345678'))

console.log(hash, 'hash of "hello world" as a uint8array')
```

## API

#### `var hash = siphash24(input, key, [hash])`

Hash a Uint8Array/buffer using siphash24.

* `key` should be a Uint8Array/buffer that is `siphash24.KEYBYTES` long
* `hash` can to be optionally passed as the output buffer and should be `siphash24.BYTES` long.

Returns the hash as a Uint8Array.

#### `siphash24.WASM_SUPPORTED`

Boolean informing you if your runtime supports WASM.

#### `siphash24.WASM_LOADED`

Boolean informing you if the WASM implementation has been loaded.

## License

MIT

---
_Source: https://npm.io/package/siphash24 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
