Cryptography for Developers: Intro
A practical introduction to modern cryptography for developers — hashing, symmetric, asymmetric, and signing.
Published:
Tags: cryptography guide developers, learn cryptography basics, developer crypto intro
Cryptography for Developers: Intro Cryptography is not optional for developers — it underpins every login form, HTTPS connection, and API token. This guide covers the foundational concepts without the mathematics: what each primitive does, when to use it, and which libraries implement it correctly. --- What is The Cardinal Rule? Never implement cryptographic algorithms from scratch. Use well-audited, widely deployed libraries. The primitives themselves (AES, SHA-256, RSA) are designed to be correct only when implemented correctly at every detail — bit operations, timing, padding. A subtle mistake in any step breaks security completely. Use these, not your own: AES: (Python), (Node.js built-in), Web Crypto API (browser) Password hashing: (Python), (Node.js) OpenPGP: , What is cryptographic…
Frequently Asked Questions
What cryptographic concepts should every developer know?
The essential concepts: hashing (SHA-256, not for passwords), password hashing (bcrypt, Argon2), symmetric encryption (AES-256-GCM), asymmetric encryption (RSA, ECC), digital signatures, message authentication codes (HMAC), TLS/HTTPS fundamentals, and the principle of using well-tested libraries rather than implementing algorithms from scratch.
What is the difference between hashing and encryption?
Hashing is a one-way function: you can compute a hash from data, but you cannot reverse it to get the data back. Encryption is a two-way function: given the key, you can both encrypt and decrypt. Hashing is used for data integrity and password storage. Encryption is used to protect data that needs to be retrieved. Hashing passwords is correct; encrypting passwords is wrong (if the key is compromised, all passwords are revealed).
What is a nonce?
A nonce (number used once) is a random value that ensures a cryptographic operation produces a unique output even with the same key and plaintext. In AES-GCM, the IV (initialization vector) is a nonce — generate fresh 12 bytes per encryption operation. In TLS, nonces prevent replay attacks. The critical rule: a nonce must never be reused with the same key.
What is a digital signature?
A digital signature is created by encrypting a hash of the data with a private key. Anyone with the corresponding public key can verify: they decrypt the signature to get the expected hash, recompute the hash from the data, and check they match. If they match, the data was signed by the private key holder and has not been modified. Digital signatures provide authentication and non-repudiation.
What is public key infrastructure (PKI)?
PKI is the ecosystem of digital certificates, certificate authorities (CAs), and protocols that enable trust in public keys at scale. When you connect to https://bank.com, your browser verifies the server's certificate — a document signed by a trusted CA confirming that the public key belongs to bank.com. PKI is what prevents man-in-the-middle attacks on the web.
All articles · theproductguy.in