Skip to content

Commit

Permalink
Use simpler formula for modulo bias
Browse files Browse the repository at this point in the history
because it's easier to understand and does not substantively affect the result.
  • Loading branch information
alanhkarp committed Jun 17, 2024
1 parent 78d19e0 commit bf6759f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/ssp.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,7 @@ let SitePasswordWeb = ((function (self) {
}
if (which === "sitepw") {
// Adjust site password for modulus bias
let m = alphabetSize
let statisticalDistance = Math.abs((256 % m)**2 - (m - 256 % m)**2)/(2*256*m);
let statisticalDistance = (256%alphabetSize)/256; // Upper bound on statistical distance
guesses = Math.floor(guesses*(1 - statisticalDistance));
}
return guesses;
Expand Down

0 comments on commit bf6759f

Please sign in to comment.