Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rayentellissy/mega-id
Lightweight library that generates very short collision-resistant ids
https://github.com/rayentellissy/mega-id
collision-resistance generate ids library npm-package npmjs
Last synced: 3 days ago
JSON representation
Lightweight library that generates very short collision-resistant ids
- Host: GitHub
- URL: https://github.com/rayentellissy/mega-id
- Owner: RayenTellissy
- License: mit
- Created: 2023-11-26T02:00:20.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2023-11-28T01:53:03.000Z (12 months ago)
- Last Synced: 2024-11-16T08:19:35.512Z (4 days ago)
- Topics: collision-resistance, generate, ids, library, npm-package, npmjs
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/megaid
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```bash
npm install megaid
```## Usage
```js
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.