2021-11-26

Generate short unique strings from larger strings [closed]

I have large strings (the strings could have alphanumerics, signs, json, html) and I need to shroten them (the shorter the better, but 16 - 32 characters will be fine). I want to apply a function to the large strings where:

1- Shorten the original string.

2- If x == y then function(x) == function(y)

3- If x != y then function(x) != function(y)

Now I'm using md5 algorithm. It works ok. (I can deal with small collisions and I don't need security, I'm using the md5 outputs as cache keys)

Is there a better/faster way to do this instead of using md5?



from Recent Questions - Stack Overflow https://ift.tt/3HPxhIx
https://ift.tt/eA8V8J

No comments:

Post a Comment