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

shg

v0.1.3

Published

Simple Hash Generator

Downloads

4

Readme

SHG

Simple Hash Generator


1. Encrypt and Decrypt

const { encrypt, decrypt } = require('shg');

const encr = encrypt('hello', 'mysecret');
const decr = decrypt(encr, 'mysecret');

console.log(encr);
console.log(decr);

Will return an output:

0111d9e0512cffc7e544698841a90dea

hello


2. Random Hex & Number Generator

const { random } = require('shg');

const hex = random.hex(10);
const num = random.number(3);

console.log(hex);
console.log(num);

Will return an output:

f34a425084

825


3. Base64 Encode & Decode

const { base64 } = require('shg');

const str = base64.encode('hi dude');

console.log(str);
console.log(base64.decode(str));

Will return an output:

aGkgZHVkZQ==

hi dude


4. Generate Hash from String

const { hash } = require('shg');

const str = 'hi dude';

console.log(hash.md5(str));
console.log(hash.sha1(str));
console.log(hash.sha256(str));
console.log(hash.sha512(str));

Will return an output:

7351d714609366a02c513121a41401f3

622caecac7dc763fff53c3c1bdd0d440a0ff5bda

46c0a4890e0b5764b3582add51c142a9090cff1cde5d6ea3e0e12753118c1025

d32b9c94a1b09a411c92a826462fb874db8a0f451393de33468d768a021c46030699aa177d5f4794ed9d05f51f5039ccaf3ec6fa723c5476e5bbf856e677453b


5. Generate HMAC Hash from String and Secret

const { hmac } = require('shg');

const str = 'hi dude';
const secret = 'mysecret';

console.log(hmac.md5(str, secret));
console.log(hmac.sha1(str, secret));
console.log(hmac.sha256(str, secret));
console.log(hmac.sha512(str, secret));

Will return an output:

a7094559834fbc2a015493b62c2701df

58066b380a08ce57e5d0d6cb898d1690fa91d4ba

d38236b80f7bf55068ec17b3904eb6fd4b8e8ed8a14bb8b6b3411bc9cda7a691

39d8626cd6d4a05dce3546f5447a9add6c8137951adb4598705ce0c37a96dde8e78dc04c792378c70790db16a7edf75b17c256d8657478a9228fa52e52f1bb66