JSPM

shorthash

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 71499
  • Score
    100M100P100Q151214F
  • License MIT

Node.js module to get a short unique hash of a string

Package Exports

  • shorthash

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (shorthash) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

shorthash

  • A mini Node.js module to generate short, alpha-number, undecryptable and unique hash id from a long string (utf8 format).
  • Use shorthash 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 shorthash, 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.

Usage

less's more, no options, just unique the string.

var sh = require("shorthash");

console.log(sh.unique('foobar@example.com'));
// you will get: Z1bL2tE

console.log(sh.unique('my name is really big big and big...'));
// you will get: Z1TirWS

console.log(sh.unique('万里长城永不倒。。。'));
// you will get: 2r6EFF

console.log(sh.unique('和平'));
// you will get: 33NM