Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I guess they haven't heard of base-64.


That doesn't solve the same set of problems as TFA. Randomized output order for sequential input, skips IDs that include profanity.


There is no need for randomised output, and they've said themselves that you can recover the input from the output. It's literally just so that it looks like something cool and technological is happening. You can skip IDs that contain base64 profanity just by doing the reverse encoding on your block list and skipping those IDs. Or you could exclude vowels from your alphabet and do a base 54 encoding. Or you could grow up and accept that your 4 millionth ID which no one is going to read might have a naughty word in it (horror).


There's no info on how this actually works. Actually I have no idea what it does in the first place.. From the FAQ:

> How can I make my IDs unique?

> The library accepts a custom alphabet from which it can generate IDs. Simply pre-shuffle the default alphabet that's provided.

I also have no idea how to use the library.. What are the 3 numbers parameters for encode()? The actual code: https://github.com/sqids/sqids-ruby/blob/main/lib/sqids.rb

I'd simply base-58 a GUID instead. At least you'll know what kind of constraints / sorting the IDs will have.



One of the points is also to use custom alphabet.




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

Search: