Hacker News new | past | comments | ask | show | jobs | submit login

Or, just use cuid2 [1] + prefix.

[1] https://github.com/paralleldrive/cuid2




One 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?


Just 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.


That goes some of the way, but I can think of a few problematic sequences that are only consonants and/or numbers.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: