Skip to content

Commit

Permalink
Adjust strength meter to account for modulo bias
Browse files Browse the repository at this point in the history
using a formula for the upper limit because it is easier to understand and doesn't make a substantive difference
  • Loading branch information
alanhkarp committed Jun 17, 2024
1 parent 3564dee commit 2402642
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Binary file modified notes/SitePassword.pages
Binary file not shown.
7 changes: 5 additions & 2 deletions src/ssp.js
Original file line number Diff line number Diff line change
Expand Up @@ -881,8 +881,6 @@ function setMeter(which) {
let guesses = getGuesses(which);
// 10^9 guesses per second, 3*10^7 seconds per year, average success in 1/2 the tries
let years = guesses/(1e9*3e7*2);
// Adjust site password for modulus bias
if (which === "sitepw") years *= 1 - (256%characters(bg.settings).length)/256;
if (which === "superpw") years /= 16*1024; // So the superpw will have more entropy than the site password
let score = getScore(years);
let index = Math.floor(score/5);
Expand Down Expand Up @@ -931,6 +929,11 @@ function setMeter(which) {
guesses *= sequence[i].guesses;
}
}
if (which === "sitepw") {
// Adjust site password for modulus bias
let statisticalDistance = (256%alphabetSize)/256; // Upper bound on statistical distance
guesses = Math.floor(guesses*(1 - statisticalDistance));
}
return guesses;
}
function guessLabel(years) {
Expand Down

0 comments on commit 2402642

Please sign in to comment.