Skip to content

Instantly share code, notes, and snippets.

@capoferro
Created November 12, 2010 15:57
Show Gist options
  • Select an option

  • Save capoferro/674257 to your computer and use it in GitHub Desktop.

Select an option

Save capoferro/674257 to your computer and use it in GitHub Desktop.
AES decryption for Authlogic
def decrypted_password
aes.decrypt
aes.key = Rails.configuration.aes256_key
password = aes.update(self.crypted_password.unpack("m").first)
(password << aes.final).gsub(%r(#{self.password_salt}$), '')
end
private
def aes
@aes ||= OpenSSL::Cipher::Cipher.new("AES-256-ECB")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment