Update LinkShortener.php to use a hash instead of random numbers
Closed this issue · 4 comments
dgarciabriseno commented
By using a hash instead of random numbers, the same long url will return the same short url.
This is the function that should be updated to accept the longUrl as an input, and return a hash.
Line 16 in 99298ea
prabhjotsingh18 commented
Hey @dgarciabriseno , I can take this issue.
just to confirm the changes
- make the function
GenerateShortString()
accept longurl as args and then return a random hash - make changes to the
public static function Create(string $longUrl): string
as well.
dgarciabriseno commented
@prabhjotsingh18, thanks for your interest, the issue is still open and you can work on it.
For the changes
- The hash returned shouldn't be random, it should return a hash of
$longUrl
- Yes, all calls to
GenerateShortString
need to be updated.
prabhjotsingh18 commented
Thanks for clearing my doubts @dgarciabriseno , will send out a PR soon.
dgarciabriseno commented
Thanks!