cunzaizhuyi / hashplate-cn

PRNG readable hash in the style of China license plates

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hashplate-cn

A tiny and fast lib to generate human-readable hash from a string in the style of China license plates.

Use

pnpm add -D hashplate-cn
import { hashplate } from "hashplate-cn";

const hash = hashplate("Hello World!");
// returns "🍢 渝F·WGVA2 🪣"

Format

The hash is generated in the following format:

<emoji> <2 uppercase letters>-<3 digits>-<2 uppercase letters> <emoji>

You can remove emoji by passing the second parameter.

import { hashplate } from "hashplate-cn";

const hash = hashplate("Hello World!", {
    hasEmoji: false,
});
// returns "渝F·WGVA2"

Why?

I needed a way to generate a hash that was readable and easy to recognize to anonymize data. This is the result.

Credit

forked from Project hashplate

About

PRNG readable hash in the style of China license plates

License:MIT License


Languages

Language:TypeScript 76.2%Language:JavaScript 23.8%