<commit_before>require 'crypt/blowfish'

case RUBY_VERSION
  when /^1.9/
    begin
      gem "crypt19", "1.2.1"
    rescue Exception
      puts "on ruby 1.9:\ngem install crypt19"
      exit 1
    end
  when /^1.8/
    begin
      gem "crypt", "1.1.4"
    rescue Exception
      puts "on ruby 1.8:\ngem install crypt19"
      exit 1
    end
  else
    puts "not sure which crypt gem to use for your version of ruby"
    exit 1
end

module Shh
  class BlowfishSerialiser
    def initialize serialiser, passphrase
      @blowfish = ::Crypt::Blowfish.new(passphrase)
      @serialiser = serialiser
    end

    def read io
      decrypted_io = StringIO.new
      while l = io.read(8) do
        decrypted_io.print @blowfish.decrypt_block(l)
      end
      @serialiser.read StringIO.new(decrypted_io.string.gsub("\0",''))
    end<commit_msg>reorder check for crypt<commit_after>case RUBY_VERSION
  when /^1.9/
    begin
      gem "crypt19", "1.2.1"
    rescue Exception
      puts "on ruby 1.9:\ngem install crypt19"
      exit 1
    end
  when /^1.8/
    begin
      gem "crypt", "1.1.4"
    rescue Exception
      puts "on ruby 1.8:\ngem install crypt19"
      exit 1
    end
  else
    puts "not sure which crypt gem to use for your version of ruby"
    exit 1
end

require 'crypt/blowfish'

module Shh
  class BlowfishSerialiser
    def initialize serialiser, passphrase
      @blowfish = ::Crypt::Blowfish.new(passphrase)
      @serialiser = serialiser
    end

    def read io
      decrypted_io = StringIO.new
      while l = io.read(8) do
        decrypted_io.print @blowfish.decrypt_block(l)
      end
      @serialiser.read StringIO.new(decrypted_io.string.gsub("\0",''))
    end
{'fraction_non_alphanumeric': 0.09252669039145907, 'fraction_numerical': 0.02965599051008304, 'mean_word_length': 2.3472222222222223, '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': '6319927', 'n_tokens_mistral': 611, 'n_tokens_neox': 580, 'n_words': 168}