zelark / nano-id-cc Goto Github PK
View Code? Open in Web Editor NEWNano ID collision calculator
Home Page: https://zelark.github.io/nano-id-cc/
License: MIT License
Nano ID collision calculator
Home Page: https://zelark.github.io/nano-id-cc/
License: MIT License
We can minify CSS by csso and remove .hljs-* classes which we don’t use
view-source:https://zelark.github.io/nano-id-cc/
I love using nanoid
and the website (this repo, https://zelark.github.io/nano-id-cc/) helps me introduce nano ID to colleagues.
I would like the website to show "matches/exceeds UUID randomness" (we can iterate on copy text) in addition to the existing "~460 billion years needed, in order to have a 1% probability of at least one collision."
Example use case:
I want to change the default alphabet (no special characters, only lowercase for case insensitivity, etc), but I want to keep at least as much entropy as UUIDs.
Right now: I have to "do the math" and "show my work" to colleagues.
With this feature request: I/My colleagues edit the alphabet and adjust the slider until it shows "matches/exceeds UUID entropy."
Input:
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
alex7kom
version -> ~376 thousands of years of work are needed in order to have a 1% probability of at least one collision.
zelark
version: ~1 billion years needed, in order to have a 1% probability of at least one collision.
Why is the difference ? Which is the correct one ?
Yeah it is a bit funny and I might be seen as a party pooper but it is somewhat inappropriate for the sort of tool it is and makes it dangerous to use at work or in public, especially since you might need to clear the alphabet to change it to something else.
I'd like to answer the question "how many rows there would need to be in our database for nanoid to have a 1% probability of producing an already existing ID". Just maybe an idea for this awesome calculator (I like the current approach, just think that maybe there could be an additional "view" on the probability).
Right now code example is not visible on standard screen (my screen is even bigger).
https://i.imgur.com/MehW8iM.png
But if we will remove Description
and Calculator
titles, we will not lose information (since it is obvious) but will save vertical size. Also, we can remove Code sample
as well.
now a different result of the calculation if the alphabet "01" and "010"
Would be a neat little convenience feature if popular alphabets from https://github.com/CyberAP/nanoid-dictionary could be selected from a dropdown or similar, without the need to manually entering the characters.
Great tool BTW!
People complain that 119 KB of JS is too big for so Nano ID website
https://twitter.com/duane_moody/status/1244783386666782722
To compare logux.io sends only 4 KB of JS.
Unfortunately, the speed field can't calculate big numbers
It's nice to have such button, especially on mobile platforms.
The current slider has values from 2 to 128. But I can’t find a case when you need more than 32 symbols in ID.
For example, the following function :
getCollisionProbability({
alphabet: String,
length: Integer,
speed: Integer,
speedUnit: String // 'hour' or 'second'
})
Could return the following value :
{
duration: Integer,
durationUnit: String, // 'second', 'minute', 'hour', 'day', 'year'
count: Integer
}
Thanks
I think we could put a link to Nano ID repo to the logo on website
The original issue is ai/nanoid#74.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.