Files
SnowLuma/.pnpm-store/v11/files/e9/a05690655006c2d0af00d9ae1a32f800702e7bc2592364e993dffeaa4bd6bcaabd8fe5a72a3e6d6075c8d2c6e36caede185dee6470486f803294e16abc5ee0
T
TanTan 2a69b23b47
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

38 lines
1.0 KiB
Plaintext

import uppercaseVariant from './variants/scoring/uppercase.mjs';
import l33tVariant from './variants/scoring/l33t.mjs';
var dictionaryMatcher = ({
rank,
reversed,
l33t,
subs,
token,
dictionaryName
}) => {
const baseGuesses = rank; // keep these as properties for display purposes
const uppercaseVariations = uppercaseVariant(token);
const l33tVariations = l33tVariant({
l33t,
subs,
token
});
const reversedVariations = reversed && 2 || 1;
let calculation;
if (dictionaryName === 'diceware') {
// diceware dictionaries are special, so we get a simple scoring of 1/2 of 6^5 (6 digits on 5 dice)
// to get fix entropy of ~12.9 bits for every entry https://en.wikipedia.org/wiki/Diceware#:~:text=The%20level%20of,bits
calculation = 6 ** 5 / 2;
} else {
calculation = baseGuesses * uppercaseVariations * l33tVariations * reversedVariations;
}
return {
baseGuesses,
uppercaseVariations,
l33tVariations,
calculation
};
};
export { dictionaryMatcher as default };
//# sourceMappingURL=scoring.mjs.map