Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spazmodius/fastGuid
Blazingly fast UUIDs in Node.js
https://github.com/spazmodius/fastGuid
module node
Last synced: 2 months ago
JSON representation
Blazingly fast UUIDs in Node.js
- Host: GitHub
- URL: https://github.com/spazmodius/fastGuid
- Owner: spazmodius
- Created: 2015-02-21T03:25:22.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2022-06-28T15:47:19.000Z (over 2 years ago)
- Last Synced: 2024-08-02T05:13:12.382Z (6 months ago)
- Topics: module, node
- Language: JavaScript
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-blazingly-fast - fastGuid - Blazingly fast UUIDs in Node.js (JavaScript)
README
# Spaz's fastGuid
Blazingly fast UUIDs in Node.js.## Install
`npm install spazmodius/fastGuid`## Usage
```
const fastGuid = require('@spazmodius/fastGuid')console.log(fastGuid()) // 21004214-9c2d-4730-813b-fbe35848fc00
console.log(fastGuid('D')) // 21004214-9c2d-4730-813b-fbe35848fc01
console.log(fastGuid('N')) // 210042149c2d4730813bfbe35848fc02
console.log(fastGuid('B')) // {21004214-9c2d-4730-813b-fbe35848fc03}// or
console.log(fastGuid.D()) // 21004214-9c2d-4730-813b-fbe35848fc04
console.log(fastGuid.N()) // 210042149c2d4730813bfbe35848fc05
console.log(fastGuid.B()) // {21004214-9c2d-4730-813b-fbe35848fc06}
```## Note
This UUID generator is freakishly fast, and generates _unique_ UUIDs, in conformance with [RFC 9562](https://tools.ietf.org/html/rfc9562). But it __does not__ generate _unguessable_ UUIDs. In particulary, sequences of 256 UUIDs
will differ only in the last byte. So if you've generated one, it's pretty easy to guess the next one.However, you [should not be using UUIDs for unguessable secrets](https://datatracker.ietf.org/doc/html/rfc9562#section-8) anyway; that is explicitly not one of their
properties. They are intended to be unique, not unguessable; please use a cryptographically random source if you need secrets.