News for hackers. Stuff that matters.
Re:Short, friendly base32 slugs from timestamps by zlib on Thursday January 19, 2023 @04:26AM (#34438352)
I always go for Hashids (https://hashids.org/)
Re:Short, friendly base32 slugs from timestamps by tokumei on Thursday January 19, 2023 @04:46AM (#34438470)
Hashids are nice
Re:Short, friendly base32 slugs from timestamps by vore on Thursday January 19, 2023 @04:50AM (#34438488)
I've never been sure of the use case of hashids. They're not really a security measure since they can be easily defeated; you might as well just expose the sequential ID at that point. If you do need something with better properties, you should probably be using UUIDv6.
Re:Short, friendly base32 slugs from timestamps by junon on Thursday January 19, 2023 @05:13AM (#34438663)
> they can be easily defeated

How? I mean they're of course no cryptographic measure but with the salt you have some secrecy.

Re:Short, friendly base32 slugs from timestamps by paulgb on Thursday January 19, 2023 @06:17AM (#34439106)
If an attacker can generate sequential hashids, they can decipher the alphabet order that hashids use without needing to know the seed, and then use the seed to invert other hashids.

I wrote a library that generates short IDs with the goal of making the similarity between two codes have nothing to do with sequence order.

https://docs.rs/block-id/latest/block_id/

Re:Short, friendly base32 slugs from timestamps by hoherd on Thursday January 19, 2023 @07:42AM (#34439697)
Fwiw, hashids do not solve OP's use case:

> Hashids is a small open-source library that generates short, unique, non-sequential ids from numbers.

vs the summary in the article:

> So now when I list atoms from my filesystem or in S3, they come back in the same order that I wrote them.