Skip to content

Commit e8062e9

Browse files
Calculate and display entropy for iCloud preset passwords
1 parent 58ce399 commit e8062e9

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

script.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -818,11 +818,14 @@ function handleGeneratePassword() {
818818
if (icloudPresetCheckbox.checked) {
819819
const pwd = generateIcloudPassword();
820820
passwordInput.value = pwd;
821-
strengthLabelEl.textContent = "";
822-
strengthBarEl.style.background = "green";
821+
822+
// iCloud: 18 letters + 1 digit, pool ~26 letters + 10 digits
823+
// Format: 3 chunks of 6 letters (CVC-CVC) + 1 digit + 1 uppercase
824+
// Entropy: 18 letters from 26 lowercase + 1 digit from 10
825+
const entropyBits = 18 * Math.log2(26) + 1 * Math.log2(10);
826+
strengthLabelEl.textContent = entropyBits < 45 ? "Weak" : entropyBits < 70 ? "Medium" : "Strong";
827+
strengthBarEl.style.background = entropyBits < 45 ? "red" : entropyBits < 70 ? "orange" : "green";
823828

824-
// iCloud preset: fixed entropy estimate (~71 bits)
825-
const entropyBits = 71;
826829
updateCrackTimeUI(entropyBits);
827830
return;
828831
}

0 commit comments

Comments
 (0)