paralleldrive / cuid

Collision-resistant ids optimized for horizontal scaling and performance.
Other
3.42k stars 123 forks source link

Check character #275

Closed Fakepng closed 1 year ago

Fakepng commented 1 year ago

Suggestion: Create a function that calculates a hash(or something that isn't long) of the cuid and concat it to the end of cuid. So function isCuid can check that the cuid has not been tampered with.

ericelliott commented 1 year ago

This is not going to happen in this library because it is not required in most apps that only need unique ids, but you could create your function that appends a checksum to the end of cuids, and then use that function anywhere you need a cuid in your own code.