<commit_before>require 'digest/sha1'
require 'digest/md5'

module Digestif
  class Hasher

    attr_accessor :options, :filename

    def initialize(filename, options)
      self.filename = filename
      self.options = options
    end

    def digest
      hasher = Digest.const_get(options.digest.to_s.upcase).new

      File.open(filename, 'rb') do |f|
        until f.eof
          hasher.update(f.read(options.read_size))
          f.seek(options.seek_size, IO::SEEK_CUR)
        end
      end
      hasher.hexdigest
    end


  end
end<commit_msg>hasher can pick out the default options on its own<commit_after>require 'digest/sha1'
require 'digest/md5'

module Digestif
  class Hasher

    attr_accessor :options, :filename

    def initialize(filename, options = CLI.default_options)
      self.filename = filename
      self.options = options
    end

    def digest
      hasher = Digest.const_get(options.digest.to_s.upcase).new

      File.open(filename, 'rb') do |f|
        until f.eof
          hasher.update(f.read(options.read_size))
          f.seek(options.seek_size, IO::SEEK_CUR)
        end
      end
      hasher.hexdigest
    end


  end
end
{'fraction_non_alphanumeric': 0.08927038626609442, 'fraction_numerical': 0.0034334763948497852, 'mean_word_length': 2.5015015015015014, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4083017', 'n_tokens_mistral': 394, 'n_tokens_neox': 372, 'n_words': 85}