Class: Digest::Class
- Inherits:
-
Object
- Object
- Digest::Class
- Defined in:
- lib/1.8/openssl.rb
Class Method Summary collapse
Instance Method Summary collapse
- #==(oth) ⇒ Object
- #digest ⇒ Object
- #hexdigest ⇒ Object
- #length ⇒ Object
- #size ⇒ Object
- #to_s ⇒ Object
Class Method Details
.digest(data, name) ⇒ Object
27 28 29 30 31 |
# File 'lib/1.8/openssl.rb', line 27 def self.digest(data, name) digester = const_get(name).new digester.update(data) digester.finish end |
.hexdigest(name, data) ⇒ Object
23 24 25 |
# File 'lib/1.8/openssl.rb', line 23 def self.hexdigest(name, data) digest(name, data).unpack('H*')[0] end |
Instance Method Details
#==(oth) ⇒ Object
41 42 43 |
# File 'lib/1.8/openssl.rb', line 41 def ==(oth) digest == oth.digest end |
#digest ⇒ Object
37 38 39 |
# File 'lib/1.8/openssl.rb', line 37 def digest dup.finish end |
#hexdigest ⇒ Object
33 34 35 |
# File 'lib/1.8/openssl.rb', line 33 def hexdigest digest.unpack('H*')[0] end |
#length ⇒ Object
53 54 55 |
# File 'lib/1.8/openssl.rb', line 53 def length digest_length end |
#size ⇒ Object
49 50 51 |
# File 'lib/1.8/openssl.rb', line 49 def size digest_length end |
#to_s ⇒ Object
45 46 47 |
# File 'lib/1.8/openssl.rb', line 45 def to_s hexdigest end |