PBKDF2 hashfactor test beter melden

svn path=/Website/trunk/; revision=29963
This commit is contained in:
Jos Groot Lipman
2016-07-06 11:42:39 +00:00
parent 278d78f77b
commit be633b7834

View File

@@ -1064,16 +1064,23 @@ checker("PBKDF2 timing (for setting S('prs_password_hash_factor'))",
var oCrypto = new ActiveXObject("SLNKDWF.Crypto");
var workfactor = 12;
var message = [];
var res = { result: resultcodes.ok };
while (1)
{
var usStart = oSLNKDWF.usTimer;
var is_hash = oCrypto.hex_pbkdf2("password", "salt", Math.pow(2, workfactor), 20);
var current = "";
var tm = ((oSLNKDWF.usTimer - usStart)/1000).toFixed(0);
if (this.S && this.S("prs_password_hash_factor") == workfactor)
{
current = " (current)"
res.info = "Current: " + workfactor;
if (tm < 100)
{
res.result = resultcodes.warning;
current = " (current, too fast)"
}
}
var tm = ((oSLNKDWF.usTimer - usStart)/1000).toFixed(0);
if (tm > 50)
{
message.push("Calculating with hash_factor {0} ({1}) took {2} ms{3}".format(workfactor, Math.pow(2, workfactor), tm, current));
@@ -1082,8 +1089,8 @@ checker("PBKDF2 timing (for setting S('prs_password_hash_factor'))",
break;
workfactor ++;
}
return { result: resultcodes.ok, message: message.join("<br>"), info: oSLNKDWF.VersionString };
res.message = message.join("<br>");
return res;
}
)