RoR - MD5 generation
How can I encrypt a string with MD5 in Rails 3.0 ?
pass = MD5.hexdigest(pass)
in a model yields uninitialized constant MyModel::MD5
Solution 1:
You can use Digest::MD5
from the Ruby standard library for this.
irb(main):001:0> require 'digest/md5'
=> true
irb(main):002:0> Digest::MD5.hexdigest('foobar')
=> "3858f62230ac3c915f300c664312c63f"
And one more thing: MD5 is a hash algorithm. You don't "encrypt" anything with a hash algorithm.