Skip to content

Lightweight library that generates very short collision-resistant ids

License

Notifications You must be signed in to change notification settings

RayenTellissy/mega-id

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mega ID

A collision-resistant ID generator.

~6 centuries of work are needed in order to have a 1% probability of at least one collision with the default id length (11 characters) when generating 100,000 ids per hour.

Install

npm install megaid

Usage

import { mgid } from "megaid"
const id = mgid() //=> "ϻYPnnϧϔλ7jO"

Security

  • Generating Megaid uses crypto api instead of Math.random(). The Crypto module uses unpredictable hardware random generator.

  • Symbols Megaid extends symbols by adding greek letters to reduce the probability of collision.

Releases

No releases published

Packages

No packages published