🚀 Socket Launch Week 🚀 Day 4: Introducing Historical Analytics.Learn More
Socket
Sign inDemoInstall
Socket

shorthash2

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shorthash2

Get a unique short hash of a string. Mainly based on shorthash.

1.0.5
latest
Source
npm
Version published
Weekly downloads
3.8K
-18.2%
Maintainers
0
Weekly downloads
 
Created
Source

shorthash2

NPM

Build Status Codecov branch GitHub package.json version

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.

Install

As NPM package:

$ npm i shorthash2

Or yarn...

$ yarn add shorthash2

Usage

import shortHash from "shorthash2";

shortHash('foobar@example.com');
// => Z1bL2tE

shortHash('my name is really big big and big...');
// => Z1TirWS

shortHash('万里长城永不倒。。。');
// => 2r6EFF

shortHash('和平');
// => 33NM

Development

  • Clone repo
  • Install dev dependencies: $ npm i
  • Run tests: $ npm test

Keywords

hash

FAQs

Package last updated on 04 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts