简体   繁体   English

将加密的密码存储在mysql中并在获取时解密

[英]Store encrypted password in mysql and decrypt while fetching

I am using DES_ENCRYPT method to store password to MySQL. 我正在使用DES_ENCRYPT方法将密码存储到MySQL。 This is working, but when I retrieve by DES_DECRYPT I get the HTML character references for certain symbols. 这是DES_DECRYPT ,但是当我通过DES_DECRYPT检索时,我得到了某些符号的HTML字符引用。 For example I stored & by encrypting, but while decrypting I get & 例如,我通过加密存储& ,但是在解密时得到& . How to handle this so that I only get & after decryption and not & 如何处理此问题,以便我只在解密后得到& ,而不是& If there is any other better direct method i can use that but in either case I need the real password stored. 如果还有其他更好的直接方法,我可以使用,但无论哪种情况,我都需要存储真实密码。

As @Carlos said phpmyadmin is probably html-encoding the html entities before showing is true. 正如@Carlos所说,在显示为真之前, phpmyadmin可能是对html实体进行html编码。 This is true. 这是真的。 There is no problem with the function. 该功能没有问题。 When i decrypt from outside phpmyadmin the password is decrypted properly. 当我从外部phpmyadmin解密时,密码已正确解密。 I made the mistake earlier i tried to directly do it from the admin panel and now i am running it from the script outside the admin panel. 我之前犯了一个错误,我尝试直接从管理面板执行此操作,现在我从管理面板外部的脚本运行该错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM