Closed sweepy84 closed 5 years ago
Nano ID doesn't have built-in namespaces (it is easy to implement then when you have long ID like in UUID, but in 10 symbols ID you can't have universal implementation, you need to know use case and limits).
In my project I just put namespace directly to ID without hashing user.id + ':' + nanoid(7)
to be able to unpack user ID from record ID.
Something like a salt function to ensure uniqueness across salt strings.
Salt doesn't garantee uniqness. And with salt you need to use software RNG which has bigger collisions probability than hardware.
Hi - I'm looking to use user-friendly short ids that are about 10 characters long and want to reduce the probability of collisions by using namespaces. To be honest I'm not entire sure I understand how namepsaces are used in uuid5 but based on what I understand it ensures a level of uniqueness across "buckets" or namespaces.
I guess I can essentially do the same thing by hashing a namespace and prepending it to the ID but was wondering if there is such a feature built into nanoid.
Something like a salt function to ensure uniqueness across salt strings.
thanks!