salt

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

浪子不回头ぞ 提交于 2019-11-26 21:56:53
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, apparently); this is fairly straightforward. However, if given a salt 20 characters and a salt 21 characters,

Why do salts make dictionary attacks 'impossible'?

大兔子大兔子 提交于 2019-11-26 21:16:27
Update: Please note I am not asking what a salt is, what a rainbow table is, what a dictionary attack is, or what the purpose of a salt is. I am querying: If you know the users salt and hash, isn't it quite easy to calculate their password? I understand the process, and implement it myself in some of my projects. s = random salt storedPassword = sha1(password + s) In the database you store: username | hashed_password | salt Every implementation of salting I have seen adds the salt either at the end of the password, or beginning: hashed_Password = sha1(s + password ) hashed_Password = sha1

What is the correct format for a blowfish salt using PHP's crypt?

冷暖自知 提交于 2019-11-26 19:54:32
问题 I have read the information provided on the PHP Manual Entry for crypt(), but I find myself still unsure of the format for a salt to trigger the Blowfish algorithm. According manual entry, I should use '$2$' or '$2a$' as the start of a 16 character string. However, in the example given later, they use a much longer string: ' $2a$07$usesomesillystringforsalt$ ', which indicates to me that whatever string I provide will be sliced and diced to fit the model. The problem I am encountering is

How can I hash passwords in postgresql?

杀马特。学长 韩版系。学妹 提交于 2019-11-26 17:56:23
问题 I need to hash some passwords with salt on postgresql, and I haven't been able to find any relevant documentation on how to get that done. So how can I hash passwords (with some salts) in postgresql? 回答1: It's been a while since I asked this question, and I'm much more familiar with the cryptographic theory now, so here is the more modern approach: Reasoning Don't use md5. Don't use a single cycle of sha-family quick hashes. Quick hashes help attackers, so you don't want that. Use a resource

Best Practices: Salting & peppering passwords?

穿精又带淫゛_ 提交于 2019-11-26 16:51:09
I came across a discussion in which I learned that what I'd been doing wasn't in fact salting passwords but peppering them, and I've since begun doing both with a function like: hash_function($salt.hash_function($pepper.$password)) [multiple iterations] Ignoring the chosen hash algorithm (I want this to be a discussion of salts & peppers and not specific algorithms but I'm using a secure one), is this a secure option or should I be doing something different? For those unfamiliar with the terms: A salt is a randomly generated value usually stored with the string in the database designed to make

bcrypt and randomly generated salts

人盡茶涼 提交于 2019-11-26 16:43:59
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) { if(CRYPT_BLOWFISH != 1) { throw new Exception("Bcrypt is not supported on this server, please see the

Do I need a “random salt” once per password or only once per database?

一曲冷凌霜 提交于 2019-11-26 15:11:10
问题 Further to my previous question about salted passwords in PHP/MySQL, I have another question regarding salts. When someone says "use a random salt" to pre/append to a password, does this mean: Creating a static a 1 time randomly generated string of characters , or Creating a string of characters that changes at random every time a password is created ? If the salt is random for every user and stored along with the hashed password, how is the original salt ever retrieved back for verification?

yii CPasswordHelper: hashPassword and verifyPassword

只愿长相守 提交于 2019-11-26 13:49:22
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. CPasswordHelper works like PHP's functions password_hash() and password_verify() , they are wrappers around the crypt() function. When you

How do I generate a SALT in Java for Salted-Hash?

亡梦爱人 提交于 2019-11-26 12:52:31
问题 I\'ve been looking around and the closest answer is : How to generate a random alpha-numeric string? I want to follow this workflow according to this CrackStation tutorial: To Store a Password Generate a long random salt using a CSPRNG. Prepend the salt to the password and hash it with a standard cryptographic hash function such as SHA256. Save both the salt and the hash in the user\'s database record. To Validate a Password Retrieve the user\'s salt and hash from the database. Prepend the

Password hashing, salt and storage of hashed values

北战南征 提交于 2019-11-26 12:50:52
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 wanting to come up with a collision should have to do the work separately for each user name and each