Skip to content

Instantly share code, notes, and snippets.

@dsturnbull
Created March 24, 2009 14:10
Show Gist options
  • Save dsturnbull/84106 to your computer and use it in GitHub Desktop.
Save dsturnbull/84106 to your computer and use it in GitHub Desktop.
irb> hashes = Hash.new { |k, v| k[v] = Digest::MD5.hexdigest(v) }
=> {}
irb> hashes['http://eigenclass.org/hiki.rb?cmd=view&p=Lexical+complexity+in+Ruby']
=> "5f1c3e54e2e8809385e994aa7e3d9fba"
irb> hashes['http://www.randomwebsite.com/']
=> "7ad5a33ea26ed12f53451c255114e870"
irb> hashes
=> {"http://eigenclass.org/hiki.rb?cmd=view&p=Lexical+complexity+in+Ruby"=>"5f1c3e54e2e8809385e994aa7e3d9fba", "http://www.randomwebsite.com/"=>"7ad5a33ea26ed12f53451c255114e870"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment