c# - BCrypt generating different hashes given the same salt, string, and factor -


using 1 of c# implementations of bcrypt hash passwords , store them sql database. when return validate against hash string bcrypt generates different hash 1 in database compare to. salts visibly same factors.

here know

$2a$12$vf/1s3mqizhwndshyzh/royuelofrj4uwv./vzwqk4o2k0uwhix7w "qwerty123" , stored in column initialized [nvarchar] (200).

when use bcrypt.verify() or bcrypt.checkpassword() depending on implementation, trace until before makes comparison , hash compare before mentioned 1 $2a$12$vf/1s3mqizhwndshyzh/rokvrepzsxfxaipdv6.ipkbpeooxzgsee

if close can see salts , factor parts same. idea causing this?

the explicit implementation working can found here http://bcrypt.codeplex.com/

my question related asp.net mvc 3 app, bcrypt.checkpassword failing

suggestion testing

private void findwhatsfailing(string password) //password = whatever you're passing in verify bcrypt working {   const string expectedpassword = "qwerty123";   if(expectedpassword != password)   {       debug.writeline("my password isn't thought was");       return;   }   string hashed = bcrypt.hashpassword(expectedpassword , bcrypt.generatesalt(12));   if(!bcrypt.verify(expectedpassword , hashed))   {      debug.writeline("something wrong bcrypt");      return;   }    /// ... test hashing password, compare hash of expectedpassword, verify password against hash of , expectedpassword   debug.writeline("everything worked, maybe database storage off?"); } 

if bcrypt.verify isn't working in example you, have no idea what's wrong, i'm guessing bcrypt isn't issue here.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -