工具箱Toolbox/密码生成器Password Generator

强密码生成器Password Generator

用 crypto.getRandomValues 取随机数,生成只存在你浏览器里的密码。 Randomness from crypto.getRandomValues, and passwords that exist only in this tab.

结果Result

长度比花哨更重要Length beats decoration

密码强度来自「可能的组合数」,也就是字符集大小乘以长度。加一个符号,字符集从 62 涨到 84,每多一位再乘 84;但长度每多一位,是乘整个字符集。所以把长度从 8 位加到 16 位,强度增长是天文级的,而从纯字母换成「字母+符号」只增长三成。NIST 的新版指南也正是这么说的:先保证长度,复杂度规则可以放宽。 Password strength comes from the number of possible combinations — alphabet size multiplied across length. Adding symbol characters grows a 62-character pool to 84; each extra character multiplies by 84. Each extra position multiplies by the whole alphabet. Going from 8 to 16 characters is astronomical; going from letters-only to letters-plus-symbols is a thirty-percent bump. The current NIST guidance says the same: prioritise length, relax composition rules.

熵与破解时间怎么算Entropy and crack time

熵的算法是「长度 × log₂(字符集大小)」,单位是比特。20 位、大小写字母加数字加符号(共 94 个字符)约 131 比特,意味着平均要试 2¹³⁰ 次。这里按每秒 100 亿次猜测估算——这是高端显卡离线爆破的数量级;在线登录有人为限流,通常慢几个数量级。这个数字只能当参考:如果密码出现在泄露库里、或者被社工猜到,实际强度远低于数学值。 Entropy is length × log₂(alphabet size), in bits. Twenty characters from 94 possible symbols is about 131 bits, meaning 2¹³⁰ guesses on average. The estimate here assumes ten billion guesses per second — the order of magnitude for offline cracking on high-end GPUs; online logins are rate-limited and orders of magnitude slower. Treat the number as a sanity check: if the password is in a breach corpus or guessable from context, real strength is far below the arithmetic.

为什么不用「记得住」的密码Why not a memorable password

人能记住的规律,机器也擅长。生日、单词加数字、键盘走势、首字母缩写,都是破解字典的头几页。真正需要记住的只有一两个主密码,其余都由密码管理器生成和填充,随机就随机了。如果确实需要一个能背下来的口令,用「骰子词」思路:从大词表里随机抽四到六个词,用分隔符连起来——「正确马电池订书钉」这种,长度足够,熵也够,比一个扭曲的单词强得多。 Patterns people can memorise are patterns machines search first: birthdays, word-plus-digits, keyboard walks, initials. The only passwords worth memorising are one or two master passwords; everything else can be generated and filled by a password manager, randomness and all. If you truly need a spoken passphrase, use the diceware idea: draw four to six words at random from a large list and join them with separators. “correct horse battery staple” is long, has real entropy, and beats one mangled dictionary word by a wide margin.

这个页面安全吗Is this page safe

密码在你的浏览器里用 Web Crypto 生成、显示,不会发出任何网络请求,刷新就没了。但「页面没上传」不等于「页面可信」:任何网页理论上都可能被篡改,所以输入主密码、恢复码这类东西,最好只在你自己控制的设备上做。想让验证更硬,可以下载页面、断网后本地打开。 Passwords are generated with Web Crypto and rendered in your browser; no network request carries them, and a refresh clears them. But “nothing is uploaded” is not the same as “this page can be trusted” — any web page could in principle be altered, so master passwords and recovery codes are best handled on a device you control. For stronger assurance, save the page and open it offline.

常见问题FAQ

「每类至少一个」会让随机性变差吗?Does “at least one per class” weaken randomness?

会轻微降低熵,因为排除了「全是字母」这类结果,选择空间小了一点,但幅度很小,换来的是能通过那些强制要求符号的网站校验。真正有害的是用固定前缀或把符号放在末尾——那会大幅缩小搜索空间。 Slightly, since it rules out all-letter outputs and trims the space a little, but the loss is small and it gets past sites that demand symbols. The genuinely harmful pattern is a fixed prefix or symbols pinned to the end — that shrinks the search space enormously.

生成 16 位够用吗?Is 16 characters enough?

对绝大多数账号足够。16 位全字符集约 105 比特,按上面的估算要数十亿年。高价值目标(邮箱主账号、密码管理器、加密货币钱包)建议 20 位以上,并配合两步验证。 For almost every account, yes. Sixteen characters from the full pool is about 105 bits — billions of years at that rate. For high-value targets (primary email, password manager, crypto wallets), use 20+ characters and two-factor authentication.

为什么不提供「记住密码」或保存功能?Why is there no “remember” or save feature?

刻意的。密码一旦存进 localStorage 或发往服务器,就有了第二份副本和第二个泄露面。要保存请用专门的密码管理器,它们有加密存储和审计。 Deliberate. A password written to localStorage or sent to a server becomes a second copy and a second exposure surface. For storage, use a dedicated password manager with encrypted vaults and audits.