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

hemoji

v0.2.1

Published

Visual hashing using emojis

Downloads

4

Readme

Hemoji

A visual hashing library with Emojis 🪁 ⛓️ 🌐 🚜

Version Downloads License Issues Vulnerabilities

Hemoji on NPM

Hemoji is a small single function JavaScript/TypeScript library that hashes a string into a sequence of emojis. Just like hashes, two identical strings passed through Hemoji will produce the same result.

This library is not intended to replace traditional hashing functions as collision are more likely. But as it provides more possibilities than alphanumeric characters for its length, it makes it a more convenient method to compare two pieces of information where it would not be possible, practical or secure to do so programmatically. Examples would include oral confirmation between two people or self confirmation in separate contexts, i.e., across separate devices.

You can try Hemoji online or continue reading on how to use it.

This is inspired by Telegram's emoji key verification feature on calls.

Getting started

Install the library using NPM:

npm i hemoji

Or Yarn:

yarn add hemoji

The library exports a single function (as default):

import hemoji from 'hemoji';
// OR
const hemoji = require('hemoji').default;

And use it!

hemoji('hemoji'); // 🪕 🎶 🦒 🎠 💝 🌗
hemoji('Hello world', { length: 8 }); // 🎟️ 🍤 🕌 🟦 📛 🔹 🔪 🚝
hemoji('Hello world', { length: 4 }); // 📌 🧾 ➿ 🥌

The first parameter is the string you wish to hash. The second (optional) parameter is an options object (see below).

Options

| Name | Type | Description | Default Value | | --- | --- | --- | --- | | version | 'v1' | Version of emoji set (based on versions.json) | 'v1' | | length | number | Number of emojis to display in the result | 6 | | spacer | string | Spacing character for the result | ' ' (space) |

How does it work?

  1. The input string gets hashed to SHA-256.
  2. The hashed result gets split into a few chunks.
  3. The emoji index array is calculated from the chunk using a modulo of the emoji index array of the decimal value of the chunk.
  4. The result of each chunk is concatenated and returned.

Other languages

There are no other implementation of Hemoji as of yet. If you implemented it in a different language, please let me know and I will add it here.

Please note that implementation in other languages have to produce the same result as this library. Refer to the versions.json file for the exact list of emojis this library is using as well as the unit tests to verify the results.

License

This project is licensed under the MIT License.