Mainly based on shorthash (apparently abandoned), by Bibig, shorthash2 offers a small optimization in memory usage, small features, typescript declarations and is available for browser and nodejs.
- A mini js lib to generate short, alpha-number, undecryptable and unique hash id from a long string (utf8 format).
- Use shorthash2 when you want to encrypt a string like a movie name or a people name to a short, unique and url friendly id.
- so with shorthash2, you can build an id-string map, instead of quering the id from db each time, you just calculate the id out on the fly.
- it's quite convenient in many conditions if you want to build a site like 书本画, a book search engine in China.
As NPM package:
$ npm i shorthash2
$ yarn add shorthash2
;;// => Z1bL2tE;// => Z1TirWS;// => 2r6EFF;// => 33NM