<commit_before>class DragonflyGenerator < Rails::Generators::Base
  source_root File.expand_path('../templates', __FILE__)

  def create_initializer
    template "initializer.rb.erb", "config/initializers/dragonfly.rb"
  end

  private

  def generate_secret
    rand(1e32).to_s(36)
  end

  if RUBY_VERSION > "1.9"
    def hash_key(key)
      "#{key}:"
    end
  else
    def hash_key(key)
      ":#{key} =>"
    end
  end
end

<commit_msg>Replace rand function with more secure SecureRandom.hex<commit_after>class DragonflyGenerator < Rails::Generators::Base
  source_root File.expand_path('../templates', __FILE__)

  def create_initializer
    template "initializer.rb.erb", "config/initializers/dragonfly.rb"
  end

  private

  def generate_secret
    SecureRandom.hex(36)
  end

  if RUBY_VERSION > "1.9"
    def hash_key(key)
      "#{key}:"
    end
  else
    def hash_key(key)
      ":#{key} =>"
    end
  end
end


{'fraction_non_alphanumeric': 0.11567567567567567, 'fraction_numerical': 0.011891891891891892, 'mean_word_length': 3.287037037037037, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 7, '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': '5212559', 'n_tokens_mistral': 338, 'n_tokens_neox': 324, 'n_words': 68}