c# - Why do PasswordDeriveBytes and Rfc2898DeriveBytes produce different results? -


i used have following code password derivatives using sha1:

string passphrase = "pas5pr@se";         string saltvalue = "s@1tvalue";         string hashalgorithm = "sha1";              int passworditerations = 2;        passwordderivebytes password =      new passwordderivebytes (passphrase, saltvaluebytes, hashalgorithm, passworditerations); 

then bytes doing:

var bytes = password.getbyes(32); 

i saw should use rfc2898derivebytes instead. replace with:

rfc2898derivebytes password1 = new rfc2898derivebytes(passphrase, saltvaluebytes, passworditerations); 

but when do:

 var bytes = password.getbytes(32); 

i don't same values. clue?

rfc2898derivebytes uses pbkdf2, while passwordderivebytes uses modified version of pbkdf1. not compatible 1 another.

given macing function, cannot convert them 1 another, either.

if want start using rfc2898derivebytes, you'll need new data only, , continue use passwordderivebytes old data or user passwords.