require 'digest/md5' str = 'daskdjsajdkljasd' md5_str = Digest::MD5.digest(str) 转载于:https://www.cnblogs.com/tomtang/p/9605823.html