Class: R509::MessageDigest
- Inherits:
-
Object
- Object
- R509::MessageDigest
- Defined in:
- lib/r509/message_digest.rb
Overview
MessageDigest allows you to specify MDs in a more friendly fashion
Constant Summary
- KNOWN_MDS =
a list of message digests that this class understands
['SHA1', 'SHA224', 'SHA256', 'SHA384', 'SHA512', 'DSS1', 'MD5']
- DEFAULT_MD =
this constant defines the default message digest if it is not supplied or an invalid digest is passed
'SHA256'
Instance Attribute Summary collapse
-
#digest ⇒ Object
readonly
Returns the value of attribute digest.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(arg = nil) ⇒ MessageDigest
constructor
A new instance of MessageDigest.
Constructor Details
#initialize(arg = nil) ⇒ MessageDigest
Returns a new instance of MessageDigest
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/r509/message_digest.rb', line 16 def initialize(arg = nil) if arg.is_a?(String) @name = arg.downcase @digest = translate_name_to_digest elsif arg.nil? @name = DEFAULT_MD @digest = translate_name_to_digest else @digest = arg @name = translate_digest_to_name end end |
Instance Attribute Details
#digest ⇒ Object (readonly)
Returns the value of attribute digest
13 14 15 |
# File 'lib/r509/message_digest.rb', line 13 def digest @digest end |
#name ⇒ Object (readonly)
Returns the value of attribute name
13 14 15 |
# File 'lib/r509/message_digest.rb', line 13 def name @name end |