From: Ryan Davis Date: 2008-12-30T09:51:11+09:00 Subject: Re: Options to generate small, kind of unique, human-readable tokens (like "V0cM9tnV") ? On Dec 29, 2008, at 01:44 , Thibaut Barrère wrote: > In the past I've been using Digest::SHA1.hexdigest(some string) which > gives us something like "d2b7882fa08bb6de8dca62f16298683bfe4f0738". > It's not very user friendly though, and definitely not small. I personally think the following is really cute: > words = File.read("/usr/share/dict/words").split > max = words.size > puts "#{words[rand(max)]}-#{words[rand(max)]}" and can generate 55194924096 different very readable combinations. I'll leave it to you to actually make them unique rather than random picks. Eric pointed me to "bubble babble" which ships in digest and makes the hash values more readable. It converts your "Xst7JGF6" into "xikal- fytif-ladog-locef-kixox". > require 'digest/bubblebabble' > puts Digest.bubblebabble("Xst7JGF6") I had no idea that existed... pretty neat.