隨機權杖產生器
產生 hex、Base64 與 URL-safe 隨機令牌,用於測試密鑰、nonce 與臨時存取值。
只在瀏覽器裡處理輸入的內容不會送到伺服器。
輸入與結果
輸入的內容只存在這個瀏覽器。重新開啟可以還原上次的操作。
使用情境
- 產生 hex、Base64 與 URL-safe 隨機令牌,用於測試密鑰、nonce 與臨時存取值。
- 以瀏覽器本機方式處理輸入,並在複製前檢查結果。
範例
- 常見輸入
32 bytes, URL-safe- 用此範例檢查 隨機權杖產生器 的輸入流程。
- 典型輸出
URL-safe token / 256 bits entropy / local browser crypto / token report- 複製前用來確認結果格式與後續檢查點。
常見錯誤
- 如果瀏覽器本機處理方式和真實輸入結構不一致,輸出不能直接信任。
- 複製的值中如果混入正式密鑰、客戶資料或內部 URL,分享前必須移除。
- 計算在瀏覽器裡完成,輸入特別長的時候出結果前可能會頓一下。
複製前確認
- 1再次比較原始輸入與輸出形態。
- 2確認目標執行環境、編碼、時區與安全政策差異。
參考資料
Cryptographic randomness in the browser
The W3C Web Cryptography API specifies that getRandomValues fills the array with cryptographically secure random bytes, and throws QuotaExceededError above 65,536 bytes per call. This tool asks for at most 128 bytes. Math.random carries no such guarantee and is not used for secrets.
依據:W3C Web Cryptography API
RFC 4648 section 5 defines base64url, which uses - and _ in place of + and /, and allows the = padding to be dropped when the length is known. That is why a URL-safe token goes into a URL, cookie or header untouched, while standard Base64 needs percent-encoding for + / and =.
依據:RFC 4648
Session identifiers need at least 64 bits
The OWASP Session Management Cheat Sheet says session IDs must carry at least 64 bits of entropy to resist guessing. The tool warns below 16 bytes (128 bits), and its default of 32 bytes is 256 bits.
依據:OWASP Session Management Cheat Sheet
常見問題
隨機權杖產生器 的輸入在哪裡處理?
可行的處理會在瀏覽器中執行,但不要輸入正式密鑰或客戶資料。
結果可以直接用於正式環境嗎?
複製前請再次確認執行環境、編碼、時區與安全政策等環境差異。