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

guid-in-words

v1.0.2

Published

Create a random GUID in human-readable form, or convert GUID to words and vice versa.

Downloads

860

Readme

Convert a hash or GUID to human-readable words

Quick example

const HexToWords = require('guid-in-words');

// Outputs:
// "same clear voice happen security sign feel option finger debate almost popular young party public easy"
HexToWords.toWords('159c1abd31af380fa31733f06eed89b8');

// Outputs "159c1abd31af380fa31733f06eed89b8":
HexToWords.toHexString('same clear voice happen security sign feel option finger debate almost popular young party public easy');

Idea

Hashes, GUIDs or other long hex strings are difficult to read and copy for humans.

Instead, you can present a hash, GUID, password or recovery phrase as a sequence of human-readable words.

This module is using a small dictionary of 256 common words that do not have strongly negative connotations (such as "death" or "catastrophe"). Since the dictionary is small, you can easily review it in the source code. On the other hand, this has a disadvantage of having too many words: one GUID or MD5 hash is reprented by 16 words.

Methods

All methods in the class are static.

Converters

  • toWords(hexString) - converts a hex string to words. The string can be uppercase hex ('48D7A7') or lowercase hex ('48d7a7'). Empty string is returned if the input is null, undefined, empty string or not a string. An exception is thrown if the string contains illegal characters (anythng except 0-9a-f).
  • toHexString(words) - converts a sequence of words into a lowercase hex string. words can be an array of strings or a string containing space-separated words. Throws an exception if the input is not an array or string, or if a word that is not in the dictionary.

GUID and hashes

  • randomGuid() - generates a random GUID (lowercase, no dashes), converts it to words and returns both as an object containing guid and words as a string.
  • md5(string), sha256(string) - generates a hash of the given string, and returns both as an object containing hash and words.
const HexToWords = require('guid-in-words');

HexToWords.md5('test');
/* Returns:
{ hash: '098f6bcd4621d373cade4e832627b4f6',
  words: 'represent commercial watch product necessary provide final mind trade identify idea occur mother nature leader agreement' }
*/

HexToWords.randomGuid();
/* Returns:
{ guid: 'e17b0f7f102c4c16b0dbe1e79e2912b6',
  words: 'key fill option economy year rule sport newspaper future enjoy key strong describe plant beat especially' }
*/

Feedback

Reports, suggestions and pull requests are welcome on Github.