mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-04-05 18:43:47 +00:00
Entropy strength measured using zxcvbn
This commit is contained in:
@@ -559,6 +559,7 @@
|
||||
<script src="js/wordlist_french.js"></script>
|
||||
<script src="js/wordlist_italian.js"></script>
|
||||
<script src="js/jsbip39.js"></script>
|
||||
<script src="js/zxcvbn.js"></script>
|
||||
<script src="js/entropy.js"></script>
|
||||
<script src="js/index.js"></script>
|
||||
</body>
|
||||
|
||||
@@ -804,6 +804,17 @@
|
||||
if (entropy.binaryStr.length >= 192) {
|
||||
strength = "extremely strong";
|
||||
}
|
||||
// If time to crack is less than one day, and password is considered
|
||||
// strong or better based on the number of bits, rename strength to
|
||||
// 'easily cracked'.
|
||||
var z = zxcvbn(entropy.cleanStr);
|
||||
var timeToCrack = z.crack_times_seconds.offline_fast_hashing_1e10_per_second;
|
||||
if (timeToCrack < 86400 && entropy.binaryStr.length >= 128) {
|
||||
strength = "easily cracked";
|
||||
if (z.feedback.warning != "") {
|
||||
strength = strength + " - " + z.feedback.warning;
|
||||
};
|
||||
}
|
||||
var bitsStr = entropy.binaryStr.length;
|
||||
if (entropy.base.asInt != 2) {
|
||||
bitsStr += " (" + entropy.binaryStr + ")";
|
||||
|
||||
28
src/js/zxcvbn.js
Normal file
28
src/js/zxcvbn.js
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user