Sha256: ccee692071a93632d880faa7a6257870c02e413ce29b802d683de913ff9dca53

Contents?: true

Size: 450 Bytes

Versions: 2

Compression:

Stored size: 450 Bytes

Contents

# frozen_string_literal: true

module Hashtastic
  class DictionaryHasher
    class << self
      def call(dictionary, filter = [])
        encoded_message = Digester.call(dictionary, filter)

        hasher = Digest::SHA3.new(256)

        hasher.update(encoded_message)

        hasher.hexdigest
      end

      private

      def extractor(dictionary, filter)
        dictionary.with_indifferent_access.slice(*filter)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hashtastic-0.3.0 lib/hashtastic/dictionary_hasher.rb
hashtastic-0.2.0 lib/hashtastic/dictionary_hasher.rb