Sha256: 198c25eb188061beb846c9b9d540d6f058d845c19fe1b2b26d23e0692eee6799
Contents?: true
Size: 790 Bytes
Versions: 2
Compression:
Stored size: 790 Bytes
Contents
require 'aes' module Devise module Encryptors # = AES # Uses the AES algorithm to encrypt passwords. class Aes256 # Returns a Base64 encrypted password where pepper is used for the key, # and the initialization_vector is randomly generated and prepended onto # encoded ciphertext def self.digest(password, stretches, salt, pepper) digest = ::AES.encrypt(pepper, password) end class << self alias :encrypt :digest end # Returns the plaintext password where pepper is used for the key, # and the initialization_vector is read from the Base64 encoded ciphertext def self.decrypt(encrypted_password, pepper) password = ::AES.decrypt(pepper, encrypted_password) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
devise_aes_encryptable-0.1.2 | lib/encryptors/aes256.rb |
devise_aes_encryptable-0.1.1 | lib/encryptors/aes256.rb |