什么是盐的最佳可能的方式盐? [英] what is best possible way of salting and storing salt?

查看:203
本文介绍了什么是盐的最佳可能的方式盐?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读关于密码盐渍,但这可能听起来有点奇怪。但是如何储存和固定盐。例如在多轮胎架构中,我使用客户机的GUID来生成我的盐,然后用户限制到单个机器,但如果我使用随机盐,它必须存储在某个地方。几天后,我看到一个示例应用程序,其中在创建新用户时在客户端系统上生成散列和盐,然后将已盐化的密码和散列传输到服务器,并将其存储在SQL服务器中。但是,如果我按照这种方法,数据库被破坏密码和每个密码的盐值将提供给X人。那么,我应该再次盐/加密密码和收到salt在服务器端?盐渍的最佳做法是什么?

Hi guys I have read about password salting, but this might sound a little odd. But how do I store and secure the salt. For example in a multi tire architecture say I use the client machine’s GUID to generate my salt then the user gets restricted to a single machine but if I use random salt it has to be stored somewhere. Few days back I saw an sample application where the hash and the salt was generated on the client system whenever a new user was created and then the salted password and the hash is transmitted to the server where they are stored in SQL server. But if I follow this method and the database is compromised the passwords and the salt values for each password will be available to the X person. So, should I again salt/encrypt the passwords and received salt on server side? What is the best practice of salting?

推荐答案

在数据库中将未加密的盐存储在散列密码旁边不是问题。

Storing the salt unencrypted in the database next to the hashed passwords is not a problem.

盐的目的不是秘密。它的目的是为每个哈希(即随机)不同,并且足够长,以击败使用彩虹表

The purpose of the salt is not to be secret. It's purpose is to be different for each hash (i.e. random), and long enough to defeat the use of rainbow tables when an attacker gets his hands on the database.

查看此优秀的帖子

编辑@ZJR :即使盐完全公开,他们仍然会失去彩虹表的好处。当你有一个盐和哈希数据,你可以做的最好的反转是强力的(假设哈希函数是加密安全)

edit @ZJR: even if the salts were completely public, they would still defeat the benefit of rainbow tables. When you have a salt and hashed data, the best you can do to reverse it is brute force (provided that the hash function is cryptographically secure)

n10i :请参阅安全散列函数的维基百科文章。至于盐的大小,流行的 bcrypt .gensalt()实现使用128位。

edit @n10i: See the wikipedia article for secure hash function. As for the salt size, the popular bcrypt.gensalt() implementation uses 128 bit.

这篇关于什么是盐的最佳可能的方式盐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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