Sqids – Generate short unique IDs from numbers
31–40 of 249 posts
Re: Sqids – Generate short unique IDs from numbers
#32I don't get it, that's like two lines of code, why does it have a library and even a domain
Re: Sqids – Generate short unique IDs from numbers
#33Re: Sqids – Generate short unique IDs from numbers
#34The standard choice of 4 to 8 random digits works well and it's clear what level of security they provide. Digits are easier to understand than case sensitive latin characters, especially when your native language uses a different character set.
Re: Sqids – Generate short unique IDs from numbers
#35I like the idea, though I use nanoid with the safe letter dictionary (it excludes letters used for profanity[0]) They should use a similar dictionary approach IMO because I looked at the implementation and it’s hardcoded to look for “bad” words Otherwise looks real straightforward! I’d love to see some performance test suites for it [0]: https://github.com/sqids/sqids-javascript/blob/ebca95e114932... [1]: though with…
Re: Sqids – Generate short unique IDs from numbers
#36For a similar thing, (X bytes to X bytes, no collisions) https://en.wikipedia.org/wiki/Format-preserving_encryption is a good page
Re: Sqids – Generate short unique IDs from numbers
#37Skipping profanity seems like a liability in this design. It means in order to preserve the encoding you need to make the banned word list immutable, otherwise old sqids will decode to the wrong thing when you get them back.
Re: Sqids – Generate short unique IDs from numbers
#38 > 1234567890.to_s(36)
=> "kf12oi"
That gets us most of the way there, but Sqid has a Ruby library and lets you set a much higher base, including upper case characters, and I suppose, emoji. We're going to need much bigger numbers before that space savings makes much difference. I like it, but it's hard to know when something like that is worth adding a dependency.Re: Sqids – Generate short unique IDs from numbers
#39It's weird under "Get Started" they have links to 40 different languages. You can only get started with 15 of the 40 languages listed, the other 25 are skeleton repos asking for people to start the repo to indicate interest.
Maybe a slam dunk first FOSS contribution?
Re: Sqids – Generate short unique IDs from numbers
#40Skipping profanity seems like a liability in this design. It means in order to preserve the encoding you need to make the banned word list immutable, otherwise old sqids will decode to the wrong thing when you get them back.
I don't think this holds, you can enforce filtering in the encoding step, i.e. be strict about what you output, but always decode, even if the input is profanity. This means you can also be backwards compatible if you update the list etc. So in short, the old maxim of be strict about your outputs and lenient about your inputs.