<commit_before>require_relative '../PasswordHash.rb'

module TestRubyAndPhpCompatiblity 
  def self.test 
    puts '----------------------------------------'
    result = system *%W(php test.php)
    puts '' 

    if !result  
      puts 'warning: PHP script did not execute successfully!!!' 
      return false
    end


    puts '----------------------------------------'
    puts 'Creating a hash using the Ruby implementation...'

    userString = "<PASSWORD>!"
    rubyHash = PasswordHash.createHash( userString )
    puts rubyHash
    
    puts ''
    puts 'Now validating this hash using a PHP implementation'
    result = system *%W(php tests/phpValidate.php #{userString} #{rubyHash})
    if !result
      puts 'warning: validation failed for a Ruby hash in PHP implementation!!!'
    end

    puts '----------------------------------------'
    TestRubyAndPhpCompatiblity.testPHPHash()
  end

  def self.testPHPHash()

    puts 'Now testing a random PHP hash with a Ruby implementation...'
    puts ''

    testData = `php phpHashMaker.php`
    testData = testData.split(' ')
    
    testPw = testData[0]
    testHash = testData[1]

    puts "Using #{testPw} as the password and using #{testHash} as the PHP hash "
    puts ''

    if PasswordHash.validatePassword(testPw, testHash)
      puts 'PHP hash validation passed!'
    else
      puts 'PHP hash validation failed!!!'
    end

  end
end

TestRubyAndPhpCompatiblity.test
<commit_msg>Remove useless whitespace<commit_after>require_relative '../PasswordHash.rb'

module TestRubyAndPhpCompatiblity
  def self.test
    puts '----------------------------------------'
    result = system *%W(php test.php)
    puts ''

    if !result
      puts 'warning: PHP script did not execute successfully!!!'
      return false
    end


    puts '----------------------------------------'
    puts 'Creating a hash using the Ruby implementation...'

    userString = "<PASSWORD>!"
    rubyHash = PasswordHash.createHash( userString )
    puts rubyHash

    puts ''
    puts 'Now validating this hash using a PHP implementation'
    result = system *%W(php tests/phpValidate.php #{userString} #{rubyHash})
    if !result
      puts 'warning: validation failed for a Ruby hash in PHP implementation!!!'
    end

    puts '----------------------------------------'
    TestRubyAndPhpCompatiblity.testPHPHash()
  end

  def self.testPHPHash()

    puts 'Now testing a random PHP hash with a Ruby implementation...'
    puts ''

    testData = `php phpHashMaker.php`
    testData = testData.split(' ')

    testPw = testData[0]
    testHash = testData[1]

    puts "Using #{testPw} as the password and using #{testHash} as the PHP hash "
    puts ''

    if PasswordHash.validatePassword(testPw, testHash)
      puts 'PHP hash validation passed!'
    else
      puts 'PHP hash validation failed!!!'
    end

  end
end

TestRubyAndPhpCompatiblity.test

{'fraction_non_alphanumeric': 0.16689655172413792, 'fraction_numerical': 0.001379310344827586, 'mean_word_length': 2.143011917659805, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1361343', 'n_tokens_mistral': 829, 'n_tokens_neox': 812, 'n_words': 260}