class Object
Constants
- EXECUTER
- FILENAME
- KEY
- TEST_CASE_FILE
Public Instance Methods
assert(expected_output, input)
click to toggle source
# File bin/code_eval, line 23 def assert(expected_output, input) puts "\nRunning Test Case #{input}" start = Time.now.to_f result = expected_output == encrypt(`#{EXECUTER} #{FILENAME} #{input}`) ? 'PASS' : 'FAIL' time = Time.now.to_f - start puts "Result: #{result}, Time: #{time.round(2)}" return result == 'PASS' ? 1 : 0 end
encrypt(msg)
click to toggle source
# File bin/code_eval, line 12 def encrypt(msg) return -1 if msg == '' encrypter = OpenSSL::Cipher::AES.new(128, :CBC) encrypter.encrypt encrypter.pkcs5_keyivgen KEY, 'wingify1' # cipher.iv = OpenSSL::PKey::RSA.new('wingify') encrypted = encrypter.update msg encrypted << encrypter.final Base64.encode64(encrypted).encode('utf-8').chomp end