<commit_before>require 'digest/sha1'

module CaptchaUtil

  def self.random_image
    @@captcha_files ||= Dir.glob("#{Rails.root}/public/system/captcha/*.png").map {|f| File.basename(f)}
    @@captcha_files[rand(@@captcha_files.size)]
  end

  def self.encrypt_string(string)
    salt = 'This really should be random'

    if defined?(CAPTCHA_SALT)
      salt = CAPTCHA_SALT
    else
      Rails.logger.warn("No salt defined, please add CAPTHCA_SALT = 'Something really random' to environment.rb")
    end  

    Digest::SHA1.hexdigest("#{salt}#{string}")
  end

end<commit_msg>CaptchaUtil now correctly pulls in captcha image files regardless of file extension.<commit_after>require 'digest/sha1'

module CaptchaUtil

  def self.random_image
    @@captcha_files ||= Dir.glob("#{Rails.root}/public/system/captcha/*.*").map {|f| File.basename(f)}
    @@captcha_files[rand(@@captcha_files.size)]
  end

  def self.encrypt_string(string)
    salt = 'This really should be random'

    if defined?(CAPTCHA_SALT)
      salt = CAPTCHA_SALT
    else
      Rails.logger.warn("No salt defined, please add CAPTHCA_SALT = 'Something really random' to environment.rb")
    end  

    Digest::SHA1.hexdigest("#{salt}#{string}")
  end

end
{'fraction_non_alphanumeric': 0.12897959183673469, 'fraction_numerical': 0.0032653061224489797, 'mean_word_length': 4.004081632653061, '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': '6158041', 'n_tokens_mistral': 450, 'n_tokens_neox': 415, 'n_words': 90}