5 ms·
I believe you'll have a lot of collisions that way, as two URLs with the same 7-byte suffix in base64 will have the same key. The Scala version uses 7 random ch
by GregorStocks 12y ago
I believe you'll have a lot of collisions that way, as two URLs with the same 7-byte suffix in base64 will have the same key. The Scala version uses 7 random characters, which I think will lead to a collision after about sqrt(36^7) entries due to the birthday paradox (62^7 if alphanumeric includes both uppercase and lowercase). That's better, but I'd recommend just using something autoincrementing instead, which in theory makes collisions impossible.
- TeeWEE 12y agoI agree. It was a short pseudo implementation.