Class: As2::DigestSelector
- Inherits:
-
Object
- Object
- As2::DigestSelector
- Defined in:
- lib/as2/digest_selector.rb
Class Method Summary collapse
Class Method Details
.for_code(code) ⇒ Object
21 22 23 |
# File 'lib/as2/digest_selector.rb', line 21 def self.for_code(code) @map[normalized(code)] || OpenSSL::Digest::SHA1 end |
.normalized(code) ⇒ Object
25 26 27 28 |
# File 'lib/as2/digest_selector.rb', line 25 def self.normalized(code) # we may receive 'sha256', 'sha-256', or 'SHA256'. code.to_s.strip.downcase.gsub(/[^a-z0-9]/, '') end |
.valid?(code) ⇒ Boolean
17 18 19 |
# File 'lib/as2/digest_selector.rb', line 17 def self.valid?(code) @map[normalized(code)] end |
.valid_codes ⇒ Object
13 14 15 |
# File 'lib/as2/digest_selector.rb', line 13 def self.valid_codes @map.keys end |