Please document length of CUID format
thebinarypenguin opened this issue · 2 comments
Are CUID lengths guaranteed to be within a specific range?
If not could you explain what contributes to the lack of uncertainty?
Answering from memory off the top of my head -- it's been a while since I had to dig into the source: cuid takes entropy in the form of numbers and converts those numbers into strings. Because those numbers and the corresponding strings encode different amounts of information per character, the length of a cuid can fluctuate by a few characters.
cuid is not going to runaway and create a super-long string.
It's also not going to go haywire and create a very short string.
In general, you should not try to depend on the length of a cuid string in any way (that's an anti-pattern).
I have been using cuid for many years in production and I have never seen this cause an issue for anybody who wasn't creating too-strict validation rules for their cuid strings.
Okay, thanks