Code
The cryptography of computers: hashes, AES and HMAC, RSA’s weak keys, Diffie–Hellman, certificates, one-time passwords, Shor and Grover, ML-KEM, BB84, Shamir’s shares, time locks, passwords.
AES & HMAC
Encrypts and decrypts with AES in GCM, CBC (PKCS#7 padding) or CTR mode through the browser's Web Crypto API, from a passphrase (PBKDF2-SHA-256, 600,000 iterations by default) or a raw 128-, 192- or 256-bit key, and computes and verifies HMAC-SHA-256/384/512; keys are never saved or shared. AES is the Rijndael cipher, standardized as FIPS 197 in 2001; GCM is NIST SP 800-38D; HMAC is RFC 2104 (1997).
Terms
History, how it works, how it was checked, limits
History
AES is the Rijndael cipher, standardised by NIST as FIPS 197 in 2001 and updated in 2023. NIST’s SP 800-38A defines the CBC and CTR modes, and SP 800-38D (2007) Galois/Counter Mode, which authenticates as it encrypts. HMAC is RFC 2104 (1997) and FIPS 198-1; PBKDF2, which stretches a passphrase into a key by iterated HMAC, is RFC 8018, and its default here of 600,000 iterations is OWASP’s figure of 2023.
How it works
All of it runs on the browser’s Web Crypto. A passphrase becomes a 128-, 192- or 256-bit key by PBKDF2-HMAC-SHA-256 with a random 16-byte salt; a raw key is 32, 48 or 64 hex digits. GCM takes a 12-byte nonce and appends a 16-byte tag covering any associated data; CBC pads by PKCS#7; CTR counts with the whole 16-byte block, as OpenSSL does. Each new message gets a fresh nonce unless one is typed. The output is hex, Base64 or a combined string beginning VVYB, which carries the parameters to decrypt with. A card enciphers Unveil’s eye under ECB beside CBC with a new key: Web Crypto has no ECB, so each block is CBC’s first under an IV of zeros. The AES tab opens each time on Unveil’s own sentence under a new random key, neither kept. The HMAC tab computes and verifies HMAC-SHA-256, -384 and -512, opening on RFC 4231’s Test Case 2.
How it was checked
On Node’s Web Crypto, the tool’s functions reproduce NIST SP 800-38A’s ECB, CBC and CTR examples (F.1.1 by way of CBC, F.2.1, F.2.2, F.2.5, F.5.1, F.5.2, F.5.5), test cases 2, 3, 4 and 16 of McGrew and Viega’s GCM specification, RFC 7914’s PBKDF2-SHA-256 vectors and RFC 4231’s cases 1, 2, 3 and 6 for the three HMACs. A changed ciphertext or missing associated data fails GCM, a wrong key fails CBC’s padding, bad lengths are refused, and combined strings round-trip. Tests read the source for the message inside [data-no-persist] and a fresh nonce for each new message.
The tests hold 73 checks of this tool; 19 rest on outside material, the first eight here:
- A standard’s own vectors RFC 7914 PBKDF2-SHA-256 passwd/salt, c=1
- A standard’s own vectors RFC 7914 PBKDF2-SHA-256 Password/NaCl, c=80000
- A standard’s own vectors RFC 4231 case 1 HMAC-SHA-256
- A standard’s own vectors RFC 4231 case 1 HMAC-SHA-384
- A standard’s own vectors RFC 4231 case 1 HMAC-SHA-512
- A standard’s own vectors RFC 4231 case 2 HMAC-SHA-256
- A standard’s own vectors RFC 4231 case 2 HMAC-SHA-384
- A standard’s own vectors RFC 4231 case 2 HMAC-SHA-512
The other 11, and every tool’s checks
Limits
The combined string is Unveil’s own; other programs need the hex or Base64 output with its parts. Associated data is not stored in it. CBC and CTR authenticate nothing, and CTR turns a wrong key into other bytes, not an error. A nonce typed by hand is kept, and reusing it under one key, which in GCM exposes both messages and the authentication key, is left to the user. Web Crypto needs a secure (https) page.