Sub topic 6
Letting the Mac generate a strong password
This chapter assumes you have turned on AutoFill for passwords in System Settings and know how a login is saved from Safari. Here you will see what Safari generates, how to use the suggestion, and how to handle sites that reject it.
Why let the Mac generate the password
People tend to build passwords from words, names and dates, and to reuse them across sites. A reused password is risky because one breached site exposes every account that shares it. A generated password solves both problems. It is random, so nobody can guess it, and it is unique to one site. You never have to remember it, because the Passwords app stores it and fills it in later.
Strength comes mainly from length and randomness. The short Python script below estimates the search space for a random password, in bits. Each extra bit doubles the number of guesses an attacker needs.
import math
def entropy_bits(length: int, alphabet_size: int) -> float:
"""Bits of entropy for a password chosen uniformly at random."""
return length * math.log2(alphabet_size)
# 8 characters from letters and digits (62 symbols)
print(round(entropy_bits(8, 62), 1))
# 20 characters from the same 62 symbols
print(round(entropy_bits(20, 62), 1))The first result is about 47.6 bits and the second is about 119.1 bits. The longer password is not twice as strong. It is roughly 2^71 times harder to guess. This only holds when the characters are truly random. A password you invent yourself has far less entropy than its length suggests.
What the generated password looks like
Safari's suggested password is long, and it is built to pass most sign-up forms. It contains lowercase letters, at least one uppercase letter, at least one digit and hyphens, arranged in short groups. The hyphens make it easier to read and to type by hand if you ever have to. The pattern is chosen so that the password passes common site rules, such as "at least one number and one capital letter".
Safari can also read a site's password rules, when the site publishes them, and adjust the suggestion to match. If a site says "maximum 16 characters" in a way the browser understands, the suggestion should respect that.
The generate-and-save flow
The usual place to generate a password is a sign-up page in Safari, or the change-password page of an account you already have.
Follow these steps on a real sign-up page:
- Open the site's sign-up or change-password page in Safari.
- Click in the new password field. Safari shows a suggestion, usually labelled Use Strong Password.
- Choose Use Strong Password. Safari fills the password into the field, and into the confirm field if there is one.
- Finish the form and submit it.
- Open the Passwords app and search for the site. The entry should be there with the username and the new password.
If you prefer your own password, choose the option to pick one yourself. Safari then treats it as an ordinary login to save. You still get the save prompt after sign-in, but nothing guarantees the password is strong.
Adjusting the suggestion
Some sites reject the default format. Typical causes are a length limit, a ban on certain symbols, or a form that cannot handle hyphens. Safari's suggestion menu may offer variants of the generated password, such as one without special characters or one that is easier to type. The exact wording and choices can differ between macOS versions, so read the menu you see rather than relying on a fixed list.
Use these variants only when the site needs them. A variant without special characters has a smaller alphabet, so it is somewhat weaker for the same length. Length makes up the difference, so keep the longest password the site allows.
| Situation | What to do |
|---|---|
| Site rejects hyphens or symbols | Pick the variant without special characters, if offered |
| Site has a short maximum length | Accept the shorter suggestion, or edit the entry to fit |
| You must type the password on another device | Use the easy-to-type variant, if offered |
| Site's form blocks pasting or autofill | Edit the entry in Passwords and type the password by hand |
Changing the password on an existing account
Generating a password also works for accounts you made years ago. Sign in to the site, go to its change-password page and click the new password field. Safari offers a strong password just as it does on sign-up pages.
When you submit the change, Safari offers to update the saved login. Accept the update. If you skip it, the Passwords app keeps the old password and your next AutoFill fills the wrong one.
The Passwords app can also lead you to these accounts. In the security recommendations, a flagged entry has a Change Password on Website link, which opens the site so you can generate a replacement. A later chapter covers those recommendations in detail.
Common problems and edge cases
- The site rejects the password after you submit. Read the error message. If the site names a rule, such as no symbols, generate a fresh suggestion in the matching format and update the entry. You can also open the entry in the Passwords app and edit the password field by hand.
- No suggestion appears. Check that AutoFill for passwords is on in System Settings. Also check that the field is recognised as a new-password field. Some pages label their fields in ways Safari cannot read. In that case, add the entry manually in the Passwords app and paste the password into the site.
- The form has no confirm field, or it fills only one field. Click the second field and choose the same password from the suggestion. Safari usually offers the one it just generated.
- The login saved under the wrong site name. Open the entry in the Passwords app and correct the website field. The website value controls which pages Safari fills, so a wrong one silently stops AutoFill.
- You replaced a password and now want the old one. The Passwords app keeps no password history. Copy the old password somewhere safe, such as the entry's notes, before you replace it, if the site's recovery path is uncertain.
- Another device needs the password. With iCloud Keychain on, the entry syncs to your other Apple devices. For a device that is not yours, show the password in the app, but do not type it into an untrusted machine.
Good habits
- Let the Mac generate a password for every new account, not only the important ones.
- Keep the longest length the site allows, and avoid variants unless the site demands them.
- Never reuse a generated password on a second site. The point of generating is one password per site.
- Do not paste generated passwords into chats or notes. Fill them through AutoFill, or view them in the Passwords app after you unlock it.
Exercise
A site rejects Safari's suggested password because it does not allow hyphens. You have already submitted the form once. Describe what you should do, and why the replacement password is slightly weaker than the original suggestion.
Show answer
Open the sign-up or change-password page again, click the new password field and choose the variant without special characters, if Safari offers one. Submit the form, then check that the entry in the Passwords app holds the password the site accepted, and edit it by hand if it does not. The replacement uses a smaller alphabet, so each character adds fewer bits of entropy. Because the password is still long and random, it remains strong. If the site allows a greater length, use it.
Exercise
Using the entropy_bits function from this chapter, calculate the entropy of a 12-character random password drawn from 62 symbols, and say whether a 20-character password from the same alphabet is more than twice as strong.
Show answer
Twelve characters give 12 × log2(62), which is about 71.5 bits. Twenty characters give about 119.1 bits. That is not just under twice the bits, but entropy is a logarithm of the number of guesses, so the 20-character password needs about 2^47.6 times more guesses, which is far more than twice as hard to guess.