I'm trying to create short non-colliding strings from longer strings in Ruby. What's the best way to do this? Base64 encode a MD5 hash?
This is the use case:
loop do
key = short_hash("#{user_id}-#{timestamp}")
break if $redis.setnx(key, "0")
end
I don't want key to be too long.