-使用 crypto.getRandomValues 在本地生成,绝不会传输。
功能说明
安全令牌生成器生成密码学安全的随机令牌,用于 API 密钥、会话密钥、分享链接和一次性密码。你以字节为单位设定随机量,选择输出格式(hex、base32、
base64base64An encoding representing binary data as 64 safe ASCII characters, so it survives transport through text-only channels. It encodes — it does not encrypt.
、base62 或字母数字),它会显示生成的字符串及其以比特为单位的真实强度。生成使用浏览器的 CSPRNG(crypto.getRandomValues)且永不离开你的设备,因此适用于真正的秘密信息。
使用方法
- 设置
EntropyEntropyThe unpredictability of a secret, measured in bits. Each added bit doubles the guesses an attacker needs; strength comes from length and randomness, not from obscurity.
(bytes) - 大多数令牌的标准是 16 字节(128 比特);高价值密钥用 32 字节(256 比特)。 - 选择 Format - hex 用于校验和/ID,base64url 用于紧凑的 web 令牌,base32 用于可能需要人工输入的场景。
- 在提供变体的地方做出选择(hex 大小写、
base64base64An encoding representing binary data as 64 safe ASCII characters, so it survives transport through text-only channels. It encodes — it does not encrypt.
与 URL 安全、base32 字母表)。 - Copy 令牌,或点击 Regenerate 生成新的。URL 会记录你的设置,因此可以分享精确的配置。
示例
128 比特 hex 令牌(16 字节)
Format: Hex → 32 characters, e.g. 9f4a2c7b8e1d0f3a5b6c7d8e9f0a1b2c - strength: strong · ~128 bits.
256 比特 base64url 令牌(32 字节)
Format: Base64 → URL-safe, 43 characters, e.g. v8aM2dQfTn_YpKxR4sLz9BwEhJm6UcAo3NqVbGi - strength: very strong · ~258 bits.
Crockford base32(20 字节)
Format: Base32 → Crockford (no I/L/O/U, unambiguous to read aloud), 32 characters - strength: strong · ~160 bits.
补充说明
- 无模偏差: 每个符号都通过拒绝采样选取,因此即使字母表不是 2 的幂(base62、字母数字),结果也保持均匀随机。
- 私密: 所有随机数都在本地生成,永不传输 - 适用于生产环境的秘密信息。
- 相关工具: Password Generator、
UUIDUUIDA 128-bit identifier generated to be practically unique without coordination, most commonly in version-4 (fully random) form.
Generator、HashHashA one-way function that maps data of any size to a fixed-length digest. Same input, same digest; any change, different digest; not reversible.
Generator。