class HashComparator::Hasher
Constants
- SUPPORTED_HASH_FUNCTIONS
Attributes
hash_function[RW]
plaintext_items[RW]
Public Class Methods
hash(hash_function:, plaintext_items:)
click to toggle source
# File lib/hash_comparator/hasher.rb, line 12 def self.hash(hash_function:, plaintext_items:) new(hash_function: hash_function, plaintext_items: plaintext_items).hash end
new(hash_function:, plaintext_items:)
click to toggle source
# File lib/hash_comparator/hasher.rb, line 16 def initialize(hash_function:, plaintext_items:) @hash_function = SUPPORTED_HASH_FUNCTIONS[hash_function] @plaintext_items = plaintext_items end
Public Instance Methods
hash()
click to toggle source
# File lib/hash_comparator/hasher.rb, line 23 def hash plaintext_items.map do |item| hash_function.hexdigest(item) end end