0.0.1 ā¢ Published 2 years ago
checkmoji v0.0.1
checkmoji
š¦„ checksum but it's emoji
- Supports a whopping 1024 different emojis
- Configurable length of up to 26 emoji-characters (default: 26)
- Uses blake2b for hashing under the hood
Installation
$ npm install checkmoji
Usage
import { checkmoji } from "./checkmoji";
// Example 1: Only 1 bit has changed for the input,
// but the output is very different:
// Yields "š š¶š¦šµšµš±š®šļøš§š¾šš„ļøšÆšŖšļøš¹šæššš·š“š²š²šš²šŗš¾š
šļøš©āššš»šŖš„šØš¦š¹"
console.log(checkmoji("a"));
// Yields "š°š¬šššš£šļøš®šøššØš»šš©āš«šØāš«šš¦šØšØšæš£š©āš¼šØāšØāš§š“š»š©āāļøšāāļøšš¹ļøšš"
console.log(checkmoji("b"));
// Example 2: Setting the length of the checksum, will return the same checksum,
// but with a different length (like in git):
// Yields 26 characters "š
¾ļøš„š¬šµššļøššØāāļøšŖšØāš¾šššš§š®šš
šš®š
ššļøāāļøš¶šš§šÆš¹š°šÆāāļøš"
console.log(checkmoji("hello, world"));
// Yields 8 characters "š
¾ļøš„š¬šµššļøššØāāļøšŖ"
console.log(checkmoji("hello, world", 8));
Note
While the character count of two checksums are the same, the actual amount of bytes used for the characters is not guaranteed. This is because each emoji can vary in size.