npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

js-keccak-tiny

v0.4.2

Published

Keccak tiny emscripten binding in javascript

Downloads

10

Readme

js-keccak-tiny

Build Status codecov

Keccak tiny wasm binding in javascript.

Keccak tiny

Keccak tiny is a c implementation of keccak, the original repository https://github.com/status-im/nim-keccak-tiny.

Install

  • install library
$ npm install js-keccak-tiny

Build with emscripten

You can build keccak-tiny wasm yourself with emscripten. To konw how to install or setup emscripten on your computer, please check their documentation https://emscripten.org/docs/getting_started/index.html. I build two version of keccak-tiny - nodejs and web. The only difference between two version is that there is no file system in web version.

$ sh build.sh

After build wasm files, you should build javascript library again.

$ npm run build

Usage

  • Hash message
// for nodejs
const keccakHashAsync = require('js-keccak-tiny/dist/node-bundle')

// for browser
const keccakHashAsync = require('js-keccak-tiny/dist/browser-bundle')

const msg = Buffer.from('It works!', 'utf8')

// initialize the library
keccakTiny = await keccakHashAsync()

let hash = keccakTiny.keccak256(msg)
// do something to hash...

Benchmark

Computer: 2.2 GHz 6-Core Intel Core i7

$ node -v
v12.18.1

> [email protected] start /Users/peterlai/Desktop/Projects/js-keccak-tiny/benchmarks
> node index.js

Keccak tiny (current) x 558,114 ops/sec ±1.68% (89 runs sampled)
Pure JS (keccak) x 288,401 ops/sec ±0.55% (97 runs sampled)
Pure JS (sha3) x 13,370 ops/sec ±1.57% (90 runs sampled)
Pure JS (js-sha3) x 280,340 ops/sec ±0.41% (94 runs sampled)
Buffer 0bytes: fastest is Keccak tiny (current)
Keccak tiny (current) x 15.01 ops/sec ±1.04% (42 runs sampled)
Pure JS (keccak) x 4.21 ops/sec ±2.51% (15 runs sampled)
Pure JS (sha3) x 0.18 ops/sec ±4.71% (5 runs sampled)
Pure JS (js-sha3) x 4.26 ops/sec ±1.81% (15 runs sampled)
Buffer 10MiB: fastest is Keccak tiny (current)

License

MIT