checkmoji
v0.0.1
Published
๐ฆฅ checksum but it's emoji
Downloads
11
Readme
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.