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

@rabbit-company/blake2b

v2.1.0

Published

Blake2b-512 hash function

Downloads

47

Readme

Blake2b-JS

A JavaScript (ES6) implementation of the Blake2b-512 cryptographic hash function.

Usage

1. Download the library

npm i --save @rabbit-company/blake2b

2. Import the library

import Blake2b from "@rabbit-company/blake2b";

3. Generate a Hash

/**
 * Generate a Blake2b hash.
 *
 * @param {string | Uint8Array} message - The input message to hash (required).
 * @param {string | Uint8Array | undefined} secret - An optional secret key for HMAC mode.
 * @param {number} [length=64] - The length of the hash output in bytes (default is 64, max is 64).
 * @param {string | Uint8Array} [salt] - An optional salt value for the hash (must be 16 bytes long).
 * @param {string | Uint8Array} [personal] - An optional personalization value (must be 16 bytes long).
 * @returns {string} - The hexadecimal representation of the hash.
 */

// Generate hash from the provided message
Blake2b.hash("message");

// Generate hash from the provided message and secret key
Blake2b.hash("message", "secretKey");

// Generate hash from the provided message, secret key and length
Blake2b.hash("message", "secretKey", 32);

// Generate hash from the provided message, secret key, length and salt
Blake2b.hash("message", "secretKey", 32, "c32df5f2f3c77a03");

// Generate hash from the provided message, secret key, length, salt and personal
Blake2b.hash(
	"message",
	"secretKey",
	32,
	"c32df5f2f3c77a03",
	"4862f0260a9803da"
);

Parameters

  • message: The input to be hashed. Can be a string or a Uint8Array.
  • secret: (Optional) A secret key for HMAC mode. Can be a string or Uint8Array. If not provided, a standard Blake2b hash will be generated.
  • length: (Optional) The length of the output hash in bytes. Defaults to 64. Must be between 1 and 64.
  • salt: (Optional) A salt value for the hash. Must be a 16-byte string or Uint8Array.
  • personal: (Optional) A personalization string for the hash. Must be a 16-byte string or Uint8Array.