Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Rails 3.0でMD5を使用して文字列を暗号化するにはどうすればよいですか? pass = MD5.hexdigest(pass) モデルでuninitialized constant MyModel::MD5
pass = MD5.hexdigest(pass)
uninitialized constant MyModel::MD5
Digest::MD5これには、Ruby標準ライブラリから使用できます。
Digest::MD5
irb(main):001:0> require 'digest/md5' => true irb(main):002:0> Digest::MD5.hexdigest('foobar') => "3858f62230ac3c915f300c664312c63f"
そしてもう1つ、MD5はハッシュアルゴリズムです。ハッシュアルゴリズムでは何も「暗号化」しません。