Crypto for Everyone – Libsodium in PHP 7.2
summary
PHP now ships bundled in PHP 7.2 with libsodium so apps get vetted primitives by default: argon2id password hashing, BLAKE2b-based generic hash, constant-time verify functions, and secure KDFs. libsodium exposes secret-key secretbox (encrypt‑then‑MAC), AEAD ciphers (ChaCha20‑Poly1305 and AES‑GCM), and public-key X25519 box (X25519 + XSalsa20 + Poly1305). Examples show encrypting API tokens with nonce+ciphertext, using memzero to wipe keys, and migrating hashes on login; mcrypt is deprecated and should be avoided.
AI-written summary · about
chapters (25)
- 0:00Introduction
- 0:35What is crypto
- 2:01Do you need cryptography code
- 2:47Should you write your own crypto code
- 3:30Crypto functions
- 6:13History of cryptographic functions
- 7:52Which extension should you use
- 9:07PHP cryptography libraries
- 11:15What is Libsodium
- 13:40Sidechannel attacks
- 15:55Timing sidechannel
- 19:28Hashing
- 23:34Hash Algorithms
- 26:19Message Authentication Codes
- 30:35Nonces
- 34:57Secret Key Encryption
- 39:55Secret Box Encryption
- 43:07Public Key Encryption
- 46:05Private Key Encryption
- 48:17Other Crypto Functions
- 50:43Password Hash
- 52:10Generating API Tokens
- 55:20Documentation
- 56:48Summary
- 57:34Question








