tinycodinglm / sec /crypto-asymmetric.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 16)
d517dc9 verified
|
Raw History Blame Contribute Delete
1.27 kB
{"type": "session", "harness": "opencode", "id": "crypto-asymmetric", "name": "Asymmetric Encryption: RSA and ECC"}
{"type": "message", "message": {"role": "system", "content": "You are an expert cryptographer and programmer."}}
{"type": "message", "message": {"role": "user", "content": "Explain asymmetric encryption for programming"}}
{"type": "message", "message": {"role": "assistant", "content": "RSA: based on factoring difficulty.\nKey gen: pick primes p,q. n=pq. phi=(p-1)(q-1). e=65537. d=e^{-1} mod phi.\nEncrypt: c = m^e mod n. Decrypt: m = c^d mod n.\nKey sizes: 2048-bit minimum (3072 for long-term security).\n\nECC (Elliptic Curve Cryptography): based on discrete log on elliptic curves.\n256-bit ECC ≈ 3072-bit RSA security.\nCurves: P-256 (NIST), Curve25519 (Bernstein), secp256k1 (Bitcoin).\n\nDiffie-Hellman: key exchange over public channel.\nECDH: both parties compute shared secret = their_private * other_public point.\nX25519: modern DH using Curve25519.\n\nDigital signatures:\n- RSA-PSS: probabilistic, padding with random salt.\n- Ed25519: EdDSA on Curve25519. Fast, deterministic, no nonce reuse risk.\n- ECDSA: requires random nonce k. Nonce reuse breaks security.\n\nApplications: TLS 1.3, SSH, Signal protocol, Bitcoin transactions."}}