Sha256: e792df71348edfaac421be3720e038451505ae135d1299e3c087f12b8a3d7c5d
Contents?: true
Size: 787 Bytes
Versions: 1
Compression:
Stored size: 787 Bytes
Contents
require 'aes' module Devise module Encryptors # = AES # Uses the AES algorithm to encrypt passwords. class AES # 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
devise_aes_encryptable-0.1.0 | lib/encryptors/aes.rb |