short uuid
See original GitHub issueI am willing to take a greater risk of collisions for a shorter uuid.
right now I have this:
"file:///home/node/.docker_r2g_cache/83cd49f2-45ba-49ec-9b72-6f84a8adeec7/residence"
I am looking for something more like:
"file:///home/node/.docker_r2g_cache/6f84a8adeec7/residence"
can this library do that or should I use another lib? any recommendations? thx
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
short-uuid - npm
Create and translate standard UUIDs with shorter formats.. Latest version: 4.2.2, last published: 2 months ago. Start using short-uuid in ...
Read more >Short UUID Generator: Short Unique ID
Tiny (4.6kB minified) no-dependency library for generating random or sequential UUID of any length with exceptionally minuscule probabilies of duplicate IDs.
Read more >oculus42/short-uuid: Translate standard UUIDs into ... - GitHub
short -uuid starts with RFC4122 v4-compliant UUIDs and translates them into other, usually shorter formats. It also provides translators to convert back and ......
Read more >Generating 8-character only UUIDs - Stack Overflow
It is not possible since a UUID is a 16-byte number per definition. But of course, you can generate 8-character long unique strings...
Read more >shortuuid - PyPI
shortuuid is a simple python library that generates concise, unambiguous, URL-safe UUIDs. Often, one needs to use non-sequential IDs in places where users ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’d suggest using another lib. This lib is specifically for creating RFC4122 UUIDs, which have a specific syntax. If all you care about is length of id, then you’ll want one that draws from a larger set of chars than the 16 hex digits.
Something like https://www.npmjs.com/package/shortid, perhaps? A 21-char id from that lib should have roughly the same chance of collision as the 36-char v4 UUID from this lib.
The shorter you make your nonce, the more likely you are to run into collisions. If you know how many unique keys you need, you can calculate the odds: look up “Birthday Paradox”. If you’re OK with the odds, it’s easiest to take a
slice
of the last ten hex digits of av4
. If you need more bits, take care to not use the bits that indicate which kind of UUID you have: those aren’t random.