Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

siphash24

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

siphash24

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

  • 1.3.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

siphash24

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

npm install siphash24

The Javascript fallback is adapted from 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

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

FAQs

Package last updated on 21 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc