tinycodinglm / sec /crypto-practical.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 16)
d517dc9 verified
|
Raw History Blame
1.37 kB
{"type": "session", "harness": "opencode", "id": "crypto-practical", "name": "Practical Cryptography for Developers"}
{"type": "message", "message": {"role": "system", "content": "You are an expert cryptographer and programmer."}}
{"type": "message", "message": {"role": "user", "content": "Explain practical cryptography for developers"}}
{"type": "message", "message": {"role": "assistant", "content": "TLS 1.3 handshake: client sends supported ciphers, server picks, key exchange via ECDHE, authentication via certificate. 1-RTT.\n\nSSH key exchange: Diffie-Hellman, server authenticates with host key, client authenticates with password or public key.\n\nJWT: header.payload.signature. Use HMAC-SHA256 or RSA-PSS. Never use 'none' algorithm.\n\nEncryption at rest: AES-256-GCM with random IV per file. Derive key from password via Argon2id.\n\nRandom number generation: /dev/urandom or getrandom() on Linux, BCryptGenRandom on Windows. Never use rand()/srand().\n\nCommon mistakes:\n- Using ECB mode (patterns leak)\n- Random nonce reuse (ECDSA, CTR mode)\n- No authentication (encrypt-then-MAC)\n- Hardcoded keys in source code\n- Weak key derivation (MD5 without salt)\n- Timing attacks on MAC comparison (use constant-time comparison)\n\nLibraries: libsodium (high-level, hard to misuse), OpenSSL (low-level, easy to misuse), ring (Rust, safe defaults)."}}