password-hash

How large should my password salt be? [duplicate]

戏子无情 提交于 2019-12-05 22:19:17
Possible Duplicate: What is the optimal length for user password salt? I have a database like below: create table user (id int primary key auto increment, username varchar(64), password varchar(128), # sha512 hash of password password_salt varchar(128) # sha512 hash of a random number used as salt ) Is this a good idea for ensuring password security with a salt? How long should a salt be? I assume that it can't hurt to have a 128bit (SHA-512) salt, but I've been wrong before. Bill Karwin I have several comments: Salts should be random and unique per user, but they don't have to be a hash

password_hash returns NULL

一世执手 提交于 2019-12-05 19:23:15
How come the documentation states that password_hash can return either a string or value false, but the following line of code returns NULL? $password = password_hash($password1, PASSWORD_BDCRYPT, array( 'cost' => 10 )); v010dya Despite the fact that it is not documented, the function does return NULL when one provides an incorrect value for algorithm. Currently supported constants are: PASSWORD_BCRYPT PASSWORD_DEFAULT And a typo in this case ( PASSWORD_BDCRYPT rather than PASSWORD_BCRYPT ) results in the value of NULL being passed, that in turn causes the same value as the return. Edit: Any

PHP password_hash function salt length 21 or 22?

落花浮王杯 提交于 2019-12-05 17:55:13
Code: echo password_hash("stackoverflow", PASSWORD_DEFAULT, ['salt' => 'twenty-one-characters'] ); Result: Warning: password_hash(): Provided salt is too short: 21 expecting 22 code: echo password_hash("stackoverflow", PASSWORD_DEFAULT, ['salt' => 'twenty-one-charactersA'] ); Result: $2y$10$dHdlbnR5LW9uZS1jaGFyYOVyX13hK9eb4/KXMAkHsAJX..YR7t/32 code: echo password_hash("stackoverflow", PASSWORD_DEFAULT, ['salt' => 'twenty-one-charactersB'] ); $2y$10$dHdlbnR5LW9uZS1jaGFyYOVyX13hK9eb4/KXMAkHsAJX..YR7t/32 Question: As you see, by appending A and B to 21 character strings we created two different

is hashing mechanism really secure?

大城市里の小女人 提交于 2019-12-05 07:54:04
问题 Well, I have always seen (and following) people saying to use hashing mechanism for storing passwords in database. I am really concerned is it secure? Lets go with example. Let's say I am hacker and I got your database name, id and password. Now I have FULL access to your database. What people say passwords should be hashed because if someone hacks, they are visible to hackers. so If I run query as select id, password FROM userDetails I will get data as below Option 1 : Without hash +++++++++

What is an alternative for bcrypt to use with node?

♀尐吖头ヾ 提交于 2019-12-04 22:43:57
I have tried for days to get bcrypt installed on my windows machine with no luck. One of the dependencies (Windows 7 SDK) does not want to be installed even though I have tried numerous suggestions from around the net it just refuses to cooperate. I need a good alternative to bcrypt which does not have any dependencies. Check out https://npmjs.org/package/bcryptjs , it's fully compatible with bcrypt just without the dependencies. Or https://npmjs.org/package/simplecrypt if you don't want the crypto boilerplate and just need to encrypt and decrypt strings. If someone faces similar issue, you

Generate SHA256 hash in Objective-C

假装没事ソ 提交于 2019-12-04 18:03:54
问题 So I need to generate a Sha256 password in Objective-C, and can't figure out for the life of me how to do it! Is there something easy I'm just missing? I've tried implementing the following method (which was written for iPhone, but I figured maybe it'd work cross-platform, as some Objective-C code does) -(NSString*)sha256HashFor:(NSString*)input { const char* str = [input UTF8String]; unsigned char result[CC_SHA256_DIGEST_LENGTH]; CC_SHA256(str, strlen(str), result); NSMutableString *ret =

Password Hashing PHP 7 [closed]

旧城冷巷雨未停 提交于 2019-12-04 11:43:43
I am currently learning PHP and I have been looking through the forum for current thinking on how best to Hash passwords in PHP. Can anyone advise on what is currently the best password hashing method to use. I have been told about PHPass, but are there better alternatives in 2017? Thank you for any advice, Ian Jay Blanchard You should never encrypt passwords, you should only hash them. Encryption implies that you can decrypt the password into a human readable form. You should never do that. Hashing is a one way street and once hashed a password cannot be recovered in human readable form.

Node.js hashing of passwords

狂风中的少年 提交于 2019-12-04 07:28:48
问题 I am currently using the following for hashing passwords: var pass_shasum = crypto.createHash('sha256').update(req.body.password).digest('hex'); Could you please suggest improvements to make the project safer? 回答1: I use the follwing code to salt and hash passwords. var bcrypt = require('bcrypt'); exports.cryptPassword = function(password, callback) { bcrypt.genSalt(10, function(err, salt) { if (err) return callback(err); bcrypt.hash(password, salt, function(err, hash) { return callback(err,

is hashing mechanism really secure?

Deadly 提交于 2019-12-03 21:58:00
Well, I have always seen (and following) people saying to use hashing mechanism for storing passwords in database. I am really concerned is it secure? Lets go with example. Let's say I am hacker and I got your database name, id and password. Now I have FULL access to your database. What people say passwords should be hashed because if someone hacks, they are visible to hackers. so If I run query as select id, password FROM userDetails I will get data as below Option 1 : Without hash ++++++++++++++++++++++++++++ + id + password + ++++++++++++++++++++++++++++ + id01 + password01 + + id02 +

What is better? Password_hash vs. SHA256 vs. SHA1 vs. md5

守給你的承諾、 提交于 2019-12-03 17:35:40
问题 What is better with salt for password storage? MD5: $hash = md5($password . $salt); Password_hash: $hash = password_hash($password, PASSWORD_DEFAULT, $salt); SHA1: $result = sha1($salt.$string); 回答1: You should absolutely use the password_hash() function without providing your own salt: $hash = password_hash($password, PASSWORD_DEFAULT); The function will generate a safe salt on its own. The other algorithms are ways too fast to hash passwords and therefore can be brute-forced too easily