I was going through the url shortner example on this page -
Although my query is simply about the hashing function that can be used to compute the shortened url .
Here it gives a way to encode the url -
I have few queries on the same -
1) suppose i use a base62
hash function to shorten a url or even some other function as anyone can easily discover this then that is not desirable.
what exactly are the reasons for this. Although it does feel bit insecure that someone knows the hash function but so what. what are the pros and cons ?
2) Database ID encoded to base_62 also won't be suitable for a production environment because it will leak information
about the database. For example, patterns can be learnt to compute the growth rate(new URLs added per day) and in the worst case, copy the whole database
How is this possible because at most a user can predict the shortenedUrl thats all .
And shortened url, original url is inserted into a database.
Please help me understand why above both are true..