Rails Devise,如何解密密码? [英] Rails Devise, how to unencrypt a password?

查看:131
本文介绍了Rails Devise,如何解密密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在rails 3设计中,用户记录具有encrypted_pa​​ssword和password_salt。

in rails 3 devise, a user record has an encrypted_password and a password_salt.

如何在控制台中获取用户的密码?如何解密?

How in the console, can I obtain a user's password? How to unencrypt?

推荐答案

默认情况下使用BCrypt算法,AFAIK不能解密。如果您需要解密密码,则需要使用其他算法,例如 AES

Devise by default uses the BCrypt algorithm, which AFAIK is not decrypt-able. If you need to be able to decrypt passwords, you need to use a different algorithm such as the AES.

有一个宝石,扩展了对Devise的AES支持。

There is a gem which extends AES support for Devise.

注意:我以纯粹的学术兴趣回答了这个问题。建议您继续使用BCrypt。我鼓励您谨慎行事,因为管理密码是有风险的。

这篇关于Rails Devise,如何解密密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆