5 ms·
Or, just use cuid2 [1] + prefix. [1] https://github.com/paralleldrive/cuid2 https://github.com/paralleldrive/cuid2
by kodisha 2y ago
Or, just use cuid2 [1] + prefix.
[1] https://github.com/paralleldrive/cuid2 https://github.com/paralleldrive/cuid2
- fnordsensei 2y agoOne thing I’ve been looking for in an ID generator is a way to supply a blocklist. There are a number of character combinations I’d like to avoid in IDs, because they might be offensive or get stuck in filters when copy-pasted (e.g. in a URI). This can be solved in user space by regenerating if the character sequences are detected, but this a) skews the distribution, and b) potentially takes time, especially when the ID generator is made to not be “too fast”. I want to generate a single ID that passes the blocklist in a timeframe that is not too fast, if that makes sense. Is there an ID generator that takes this into consideration?
- ceejayoz 2y agoJust take out the vowels and numbers that can look like vowels. Nixing 0 means no b00bs IDs, and avoids 0/O; I usually take out 1/I as well.
- fnordsensei 2y agoThat goes some of the way, but I can think of a few problematic sequences that are only consonants and/or numbers.