Generate cryptographically secure API keys, tokens, JWTs, and secrets
| Use Case | Recommended Format | Bits | Example |
|---|---|---|---|
| JWT Secret | Hex 64 | 512 bits | a3f9b2c1d4e5… |
| Session Token | Hex 32 | 256 bits | 8f4a2b1c3d5e… |
| API Token | UUID v4 | 128 bits | 550e8400-e29b… |
| Encryption Key | Base64 | 256 bits | K8mN2pQ7rS1t… |
| Database Password | Hex 32 | 256 bits | 3c9a1f2b4d6e… |
| CSRF Token | Hex 32 | 256 bits | 7b3d5f1a9c2e… |
A secure API key must be generated using a Cryptographically Secure Pseudo-Random Number Generator (CSPRNG) — never using Math.random(), timestamps, UUIDs from non-crypto sources, or any predictable algorithm. PassKit.in uses crypto.getRandomValues(), the Web Crypto API's CSPRNG, to generate all keys with true randomness. A 32-byte Hex key (256 bits) has the same security level as AES-256 encryption keys.
xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx. Standard for database row IDs and session tokens. Per RFC 4122. ~122 bits of actual randomness (6 bits used for version/variant flags).UUID v4 (Universally Unique Identifier, version 4) is a 128-bit random identifier standardized in RFC 4122. Format: 550e8400-e29b-41d4-a716-446655440000. The "4" in position 13 identifies version 4 (random). Bits 64–65 are set to 10 (the RFC variant). PassKit.in generates compliant v4 UUIDs using crypto.getRandomValues(), setting bytes[6] = (bytes[6] & 0x0f) | 0x40 and bytes[8] = (bytes[8] & 0x3f) | 0x80 per the standard.
Math.random() is a pseudo-random number generator seeded by the current time. Its output is predictable — an attacker who knows the approximate time your key was generated can reconstruct the seed and brute-force possible outputs in milliseconds. Real-world attacks have exploited this in PHP (rand()), Java (java.util.Random), and JavaScript (Math.random()). Always use crypto.getRandomValues() (browser) or crypto.randomBytes() (Node.js) for security-sensitive values.
8-4-4-4-12. Version 4 means it is randomly generated (vs v1 which is time-based). PassKit.in generates RFC 4122-compliant v4 UUIDs using crypto.getRandomValues(): generate 16 random bytes, set byte 6 to version 4 (0x4x), set byte 8 to variant 2 (0x8x–0xbx), then format as hex string with dashes.crypto.getRandomValues() — the same source used by your OS for cryptographic operations. They are suitable for API secrets, JWT signing keys, OAuth tokens, session IDs, HMAC keys, database UUIDs, and any security-sensitive application. Copy and use them directly.