mysql 散列,在MySQL中存储散列密码

博客讨论了在PHP中使用盐值SHA1进行密码哈希后,在MySQL中存储哈希结果的最佳实践。建议使用CHAR(40)作为字段类型,长度足以容纳SHA1哈希值,且字符编码选择与数据库其余部分保持一致。同时提到,SHA256和SHA512也是可行的哈希选项,但未深入探讨。
摘要由CSDN通过智能技术生成

I'm creating hashed passwords using salted sha1 in PHP.

My question is: In MySQL what is the proper character encoding, field type & length to store the result?

Is there anything else in MySQL to consider for password security?

Finally are SHA256 or SHA512 practical hashing choices?

解决方案

For a SHA1 hash, CHAR(40) would be the optimal field type and length.

Character encoding shouldn't matter much, all the characters are within the ASCII range. I'd go with the same character set as the rest of your database for consistency.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值