salt

Where do you store your salt strings?

核能气质少年 提交于 2019-11-26 12:36:11
I've always used a proper per-entry salt string when hashing passwords for database storage. For my needs, storing the salt in the DB next to the hashed password has always worked fine. However, some people recommend that the salt be stored separately from the database. Their argument is that if the database is compromised, an attacker can still build a rainbow table taking a particular salt string into account in order to crack one account at a time. If this account has admin privileges, then he may not even need to crack any others. From a security perspective, is it worth it to store salts

What is the optimal length for user password salt? [closed]

跟風遠走 提交于 2019-11-26 12:05:41
Any salt at all will obviously help when salting and hashing a user's password. Are there any best practices for how long the salt should be? I'll be storing the salt in my user table, so I would like the best tradeoff between storage size and security. Is a random 10 character salt enough? Or do I need something longer? Most of these answers are a bit misguided and demonstrate a confusion between salts and cryptographic keys. The purpose of including salts is to modify the function used to hash each user's password so that each stored password hash will have to be attacked individually. The

How to retract a salted password from the Database and auth user?

情到浓时终转凉″ 提交于 2019-11-26 10:58:02
This is my first trial for implementing a member site with salted passwords which are all stored in the DB (MySQL). Everything works except for the error in the 'login for members' page. The Error: Member login page accepts any entry to the membership site and for some reason passes my check for $result === false This is the code for checking if member exists, please let me know what the problem is: $servername = 'localhost'; $username = 'root'; $pwd = ''; $dbname = 'lp001'; $connect = new mysqli($servername,$username,$pwd,$dbname); if ($connect->connect_error){ die('connection failed, reason:

Why does crypt/blowfish generate the same hash with two different salts?

寵の児 提交于 2019-11-26 08:08:49
问题 This question has to do with PHP\'s implementation of crypt(). For this question, the first 7 characters of the salt are not counted, so a salt \' $2a$07$a \' would be said to have a length of 1, as it is only 1 character of salt and seven characters of meta-data. When using salt strings longer than 22 characters, there is no change in the hash generated (i.e., truncation), and when using strings shorter than 21 characters the salt will automatically be padded (with \' $ \' characters,

Salt and hash a password in Python

Deadly 提交于 2019-11-26 07:57:28
问题 This code is supposed to hash a password with a salt. The salt and hashed password are being saved in the database. The password itself is not. Given the sensitive nature of the operation, I wanted to make sure everything was kosher. import hashlib import base64 import uuid password = \'test_password\' salt = base64.urlsafe_b64encode(uuid.uuid4().bytes) t_sha = hashlib.sha512() t_sha.update(password+salt) hashed_password = base64.urlsafe_b64encode(t_sha.digest()) 回答1: EDIT: This answer is

yii CPasswordHelper: hashPassword and verifyPassword

旧城冷巷雨未停 提交于 2019-11-26 05:56:41
问题 I think I\'m missing something critical here. In the CPasswordHelper::hashPassword function we have lines: $salt=self::generateSalt($cost); $hash=crypt($password,$salt); return $hash; And in the CPasswordHelper::verifyPassword there is this line: $test=crypt($password,$hash); return self::same($test, $hash); What about the salt? To my understanding its not even beeing kept, but it doesn\'t make any sense, so I\'m guessing I didn\'t understand it completely. 回答1: CPasswordHelper works like PHP

bcrypt and randomly generated salts

﹥>﹥吖頭↗ 提交于 2019-11-26 04:55:08
问题 So I was experimenting with bcrypt. I have a class(shown below, which I got from http://www.firedartstudios.com/articles/read/php-security-how-to-safely-store-your-passwords) in which there are 3 functions. 1st one is to generate a random Salt, the 2nd to generate a hash using the 1st generated Salt and the last one is to verify the supplied password by comparing it with the hashed password. <?php /* Bcrypt Example */ class bcrypt { private $rounds; public function __construct($rounds = 12) {

Do I need to store the salt with bcrypt?

落爺英雄遲暮 提交于 2019-11-26 04:36:58
问题 bCrypt\'s javadoc has this code for how to encrypt a password: String pw_hash = BCrypt.hashpw(plain_password, BCrypt.gensalt()); To check whether a plaintext password matches one that has been hashed previously, use the checkpw method: if (BCrypt.checkpw(candidate_password, stored_hash)) System.out.println(\"It matches\"); else System.out.println(\"It does not match\"); These code snippets imply to me that the randomly generated salt is thrown away. Is this the case, or is this just a

What is the optimal length for user password salt? [closed]

独自空忆成欢 提交于 2019-11-26 03:35:29
问题 Any salt at all will obviously help when salting and hashing a user\'s password. Are there any best practices for how long the salt should be? I\'ll be storing the salt in my user table, so I would like the best tradeoff between storage size and security. Is a random 10 character salt enough? Or do I need something longer? 回答1: Most of these answers are a bit misguided and demonstrate a confusion between salts and cryptographic keys. The purpose of including salts is to modify the function

Password hashing, salt and storage of hashed values

坚强是说给别人听的谎言 提交于 2019-11-26 03:07:35
问题 Suppose you were at liberty to decide how hashed passwords were to be stored in a DBMS. Are there obvious weaknesses in a scheme like this one? To create the hash value stored in the DBMS, take: A value that is unique to the DBMS server instance as part of the salt, And the username as a second part of the salt, And create the concatenation of the salt with the actual password, And hash the whole string using the SHA-256 algorithm, And store the result in the DBMS. This would mean that anyone