前端python密码hash加盐加密_使用Python盐化哈希密码(每个新密码使用不同的盐)...

As far as my understanding after reading and researching, the purpose of using salt is supposed to be a different salt for every single password to be stored.

If the same salt is used for storing all password, I can understand how to implement this, as I could just store the salt to a constant private variable and use it. But, that's not the case.

Though it makes perfect sense for storing every new password with new different salt, but how do I suppose to know which user's password associated to which salt ? The quick solution I thought of, was to store the salt along with the user's table property, maybe called as 'salt', but that will lose the purpose of having the salt from the first place too if it's too easy to find the salt from the database.

Can anyone advice on this ?

NOTE: I'm using either Python built in library (hashlib) or Bycrypt (Cryptacular or Passlib)

解决方案The quick solution I thought of, was to store the salt along with the user's table property

That's exactly what you do. Knowing the salt doesn't really detract from their benefits:

Identical passwords in your database will have different hashes.

Rainbow tables won't work.

Brute-force attacks that attempt to match against any of your hashes will be slowed down.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值