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

hash-maker

v1.0.13

Published

A collection of hash and number generators for Node or Browser

Downloads

26

Readme

hash-maker

A collection of hash and number generators for Node or Browser in pure JS.

  • SHA - Creates a SHA1/224/256/384/512 hash of a message.
  • MD5 - Creates a MD5 hash of a message.
  • CRC - Createsa CRC3/16/32 hash of a message.
  • UUID - Create UUIDs verisons 1 - 5.
  • Random bytes - Random bytes of a supplied length (based on Mersenne Twister)
  • Mersenne Twister - Random number generator that can be seaded. Create 32 bit signed, unsigned or float values.
  • Random Xor Shift - Random number generator that can be seaded. Creates unsigned 32 bit values.

Installation

npm install hash-maker

Provides both CommonJS and ES modules.

SHA

SHA hash function. All SHA functions can be returned as a string, Uint8Array, Buffer or Hex string (default).

Can be imported as:

const { SHA256 } = require('hash-maker');
//
import { SHA256 } from 'hash-maker';
const hash = SHA256("0123456789",{asArray:true});

MD5

MD5 hash function. MD5 functions can be returned as a string, Uint8Array, Buffer or Hex string (default).

Can be imported as:

const { MD5 } = require('hash-maker');
//
import { MD5 } from 'hash-maker';
const hash = MD5("0123456789",{asArray:true})

CRC

CRC hash function. CRC functions can be returned as a Hex string, Uint8Array, Buffer or number (default).

Can be imported as:

const { CRC32 } = require('hash-maker');
//
import { CRC32 } from 'hash-maker';
const hash = CRC32("0123456789",{asArray:true});

UUID

UUID generator function. UUID functions can create verisons 1 - 5 (default 4) and can be returned as a Uint8Array, Buffer or Hex string (default).

Can be imported as:

const { UUID } = require('hash-maker');
//
import { UUID } from 'hash-maker';
const id = UUID(1,{asArray:true});

Random Bytes

Random byte generator function. Functions can be returned as a Buffer or Uint8Array (default). Numbers generated with the Mersenne Twister (see below).

Can be imported as:

const { randomBytes } = require('hash-maker');
//
import { randomBytes } from 'hash-maker';
const bytes = randomBytes(12,true);

Mersenne Twister

Mersenne Twister number generator class. Can be seeded with a number or Uint32Array.

Can be imported as:

const { MERSENNETWISTER } = require('hash-maker');
//
import { MERSENNETWISTER } from 'hash-maker';
const seed; // number or Uint32Array if needed
const mt = new MERSENNETWISTER(seed);
const unsignedInt = mt.genrand_int32() // or mt.RandTwisterUnsigned() mt.random_int()
const signedInt = mt.genrand_int32i() // or mt.RandTwisterSigned()
const unsigned31Int = mt.genrand_int3i() //31 bit number
const double = mt.genrand_real1() // or mt.RandTwisterDouble()
const float1 = mt.genrand_real2() // generates a random number on [0,1)-real-interval
const float2 = mt.genrand_real3() // generates a random number on (0,1)-real-interval
const float3 = mt.genrand_res53() // generates a random number on [0,1) with 53-bit resolution

Random Xor Shift

Random Xor Shift number generator class. Can seeded with a number or a Uint8Array or Buffer of 4 bytes.

Can be imported as:

const { RANDOMXORSHIFT } = require('hash-maker');
//
import { RANDOMXORSHIFT } from 'hash-maker';
const seed; //number, Uint8Array or Buffer of 4 bytes
const rxs = new RANDOMXORSHIFT(seed);
const random_int = rxs.random_int();