]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/blobdiff - src/js/index.js
Entropy strength measured using zxcvbn
[perso/Immae/Projets/Cryptomonnaies/BIP39.git] / src / js / index.js
index 66585a95993a64aff9921657588f8b566e2ebd4f..3690de1c6cdbde5bca14d5459542cc24ee8b3ecb 100644 (file)
         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 + ")";