Sha256: 12bef51baa72d1f060b1183925c9511f10a650bcf328fca2a2b47137c260d9bd
Contents?: true
Size: 834 Bytes
Versions: 2
Compression:
Stored size: 834 Bytes
Contents
require 'aes' module Devise module Encryptors # = AES # Uses the AES algorithm to encrypt passwords. class Aes256 < Base class << self # 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 digest(password, stretches, salt, pepper) digest = ::AES.encrypt(password, pepper, {:iv => salt}) end alias :encrypt :digest # Returns the plaintext password where pepper is used for the key, # and the initialization_vector is read from the Base64 encoded ciphertext def decrypt(encrypted_password, pepper) password = ::AES.decrypt(encrypted_password, pepper) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
devise_aes_encryptable-0.2.1 | lib/encryptors/aes256.rb |
devise_aes_encryptable-0.2.0 | lib/encryptors/aes256.rb |