lib/keepassx/aes_crypt.rb in keepassx-0.1.0 vs lib/keepassx/aes_crypt.rb in keepassx-1.0.0
- old
+ new
@@ -1,19 +1,29 @@
+# frozen_string_literal: true
+
module Keepassx
module AESCrypt
- def self.decrypt(encrypted_data, key, iv, cipher_type)
- aes = OpenSSL::Cipher::Cipher.new(cipher_type)
+ module_function
+
+ # rubocop:disable Naming/UncommunicativeMethodParamName
+ def decrypt(encrypted_data, key, iv, cipher_type)
+ aes = OpenSSL::Cipher.new(cipher_type)
aes.decrypt
aes.key = key
- aes.iv = iv unless iv.nil?
+ aes.iv = iv unless iv.nil?
aes.update(encrypted_data) + aes.final
end
+ # rubocop:enable Naming/UncommunicativeMethodParamName
- def self.encrypt(data, key, iv, cipher_type)
- aes = OpenSSL::Cipher::Cipher.new(cipher_type)
+
+ # rubocop:disable Naming/UncommunicativeMethodParamName
+ def encrypt(data, key, iv, cipher_type)
+ aes = OpenSSL::Cipher.new(cipher_type)
aes.encrypt
aes.key = key
- aes.iv = iv unless iv.nil?
+ aes.iv = iv unless iv.nil?
aes.update(data) + aes.final
end
+ # rubocop:enable Naming/UncommunicativeMethodParamName
+
end
end