class Hashtastic::DictionaryHasher

Public Class Methods

call(dictionary, filter = []) click to toggle source
# File lib/hashtastic/dictionary_hasher.rb, line 6
def call(dictionary, filter = [])
  encoded_message = Digester.call(dictionary, filter)

  hasher = Digest::SHA3.new(256)

  hasher.update(encoded_message)

  "0x#{hasher.hexdigest}"
end

Private Class Methods

extractor(dictionary, filter) click to toggle source
# File lib/hashtastic/dictionary_hasher.rb, line 18
def extractor(dictionary, filter)
  dictionary.with_indifferent_access.slice(*filter)
end