In the case of a collision, an alternative would be:
check if the full url is the same - if it's the same, then just use the existing short url
add an extra digit (e.g. 0) to the end of the short url, and increment that digit until it is unique (in the case of multiple collisions), padding may be required for small inode numbers
So if a collision occurred for inode 123456789, it would be converted to 1234567890, and then 1234567891 for the next collision, and so forth.
Although djb2 is hard to reverse, it may be prone to collisions (https://github.com/m9psy/DJB2_collision_generator).
In the event of a collision, what should we do?
One possibility: Considering if #5 is implemented, in the event of a collision we could have numerically indexed link files. E.G.,:
The short url returned would be
base/key.index
E.G.,http://I.no.de/1234.0
.There may be better patterns to handle this.