Hashids is a small JavaScript library for creating YouTube-like IDs from numbers. Use it when you don’t want to view your database IDs for the user.
How to make use of it:
Install the Hashids package.
# NPM $ npm install hashids --save
Import the Hashids module.
import Hashids from './lib/hashids.js'
Initialize the Hashids.
var myHashId = new Hashids();
Encode a number or hex.
// Mj3 hashids.encode(123); // LPj9LA hashids.encodeHex('fafafa');
Decode the generated IDs.
hashids.decode(id); hashids.decodeHex(id);
Config the library bypassing the next parameters:
// Hashids(salt, minLength, alphabet) var myHashId = new Hashids(0, 5, 'abc');
Check if is legitimate.
hashids.isValidId(id);
Generate Unique IDs Like Youtube, Hashids Plugin/Github
See Demo And Download
Official Website(niieani): Click Here
This superior jQuery/javascript plugin is developed by niieani. For extra Advanced usage, please go to the official website.