lib/gibberish/digest.rb in gibberish-0.0.2 vs lib/gibberish/digest.rb in gibberish-1.0.0
- old
+ new
@@ -1,5 +1,13 @@
module Gibberish
+ # Allows for the simple digest of data, supports MD5, SHA1, and SHA256
+ #
+ # ## Examples
+ #
+ # Gibberish::MD5("data") #=> 8d777f385d3dfec8815d20f7496026dc
+ # Gibberish::SHA1("data") #=> a17c9aaa61e80a1bf71d0d850af4e5baa9800bbd
+ # Gibberish::SHA256("data") #=> 3a6eb0790f39ac87c94f3856b2dd2c5d110e6811602261a9a923d3bb23adc8b7
+ #
class Digest
def self.sha1(val, opts={})
if opts[:binary]
OpenSSL::Digest::SHA1.digest(val)