HackerTrans
TopNewTrendsCommentsPastAskShowJobs

dumbo-octopus

no profile record

comments

dumbo-octopus
·há 2 anos·discuss
I’d prefer it to be one that the developers have specifically targeted and developed/tested against, especially if there’s any GPU involvement.
dumbo-octopus
·há 3 anos·discuss
There explicitly is no uniqueness guarantee. It is known that the same values can encode into many different strings, and they recommend always decoding then reencoding with a stable algorithm to achieve a "canonical" id if one is needed.

https://sqids.org/faq#valid-ids
dumbo-octopus
·há 3 anos·discuss
But then why not just arbitrary text?
dumbo-octopus
·há 3 anos·discuss
Odd design decision in that if you provide your own blocklist, it overwrites their (extensive) default list instead of adding to it.

And in general the algorithm is surprisingly complicated for something that could be replaced with simply base64 encoding, the given example (1,2,3) base64 encodes to a string with just one more letter than this algorithm.

That said I do appreciate the semicolon-free-style. I don't typically see that in libs besides my own.

https://github.com/sqids/sqids-javascript/blob/main/src/sqid...