<commit_before>require 'openssl'
require 'securerandom'

class Crypt
  def self.encrypt(opts = {})
    crypt :encrypt, opts
  end

  def self.decrypt(opts = {})
    crypt :decrypt, opts
  end

  def self.new_iv
    new_cipher.random_iv
  end

  def self.new_salt
    SecureRandom.uuid
  end

private
  def self.new_cipher
    OpenSSL::Cipher::AES.new(256, :CBC)
  end

  def self.crypt(method, opts)
    raise ArgumentError if
      opts.nil? || opts.empty? || opts[:value].nil? ||
      opts[:password].nil? || opts[:salt].nil? ||
      opts[:iv].nil? || opts[:stretch].nil?
<commit_msg>Adding more parameter validation for Crypt.<commit_after>require 'openssl'
require 'securerandom'

class Crypt
  def self.encrypt(opts = {})
    crypt :encrypt, opts
  end

  def self.decrypt(opts = {})
    crypt :decrypt, opts
  end

  def self.new_iv
    new_cipher.random_iv
  end

  def self.new_salt
    SecureRandom.uuid
  end

private
  def self.new_cipher
    OpenSSL::Cipher::AES.new(256, :CBC)
  end

  def self.crypt(method, opts)
    raise ArgumentError if
      opts.nil? || opts.empty? || opts[:value].nil? ||
      opts[:password].nil? || opts[:password].empty? ||
      opts[:salt].nil? || opts[:salt].empty? ||
      opts[:iv].nil? || opts[:iv].empty? ||
      opts[:stretch].nil? || opts[:stretch].nil?

{'fraction_non_alphanumeric': 0.14744079449961803, 'fraction_numerical': 0.004583651642475172, 'mean_word_length': 3.1853035143769968, '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': '27955', 'n_tokens_mistral': 484, 'n_tokens_neox': 452, 'n_words': 99}