Class: Kryptonita::Hash
- Inherits:
-
Object
- Object
- Kryptonita::Hash
- Defined in:
- lib/kryptonita.rb
Class Method Summary collapse
Class Method Details
.md5(str, salt: nil) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/kryptonita.rb', line 16 def self.md5(str, salt: nil) if salt.nil? Digest::MD5.hexdigest(str) else Digest::MD5.hexdigest(Digest::MD5.digest(str) + salt) end end |
.sha1(str) ⇒ Object
24 25 26 |
# File 'lib/kryptonita.rb', line 24 def self.sha1(str) Digest::SHA1.hexdigest(str) end |
.sha512(str) ⇒ Object
28 29 30 |
# File 'lib/kryptonita.rb', line 28 def self.sha512(str) Digest::SHA512.hexdigest(str) end |