GeneratePass
CATEGORY HUB

Cryptography

The mathematical foundations of digital security. Understand hash functions, encryption algorithms, encoding standards, and the cryptographic primitives that protect data worldwide.

What is Cryptography?

Cryptography is the science of securing communication and data in the presence of adversaries. From the Caesar cipher used by Roman generals to the elliptic curve algorithms protecting modern web traffic, cryptography has evolved into the invisible infrastructure of digital trust.

At its core, cryptography provides three guarantees: confidentiality (only authorized parties can read the data), integrity (the data has not been tampered with), and authenticity (the data comes from who it claims to come from). Every HTTPS connection, password hash, digital signature, and encrypted message relies on these principles.

Modern cryptography is built on well-studied mathematical problems that are easy to compute in one direction but computationally infeasible to reverse — such as factoring large prime numbers, computing discrete logarithms, or finding hash preimages.

Symmetric vs Asymmetric Encryption

Symmetric

One Key, Two Operations

Symmetric encryption uses the same key for both encryption and decryption. Algorithms like AES-256-GCM and ChaCha20-Poly1305 are extremely fast and widely used for bulk data encryption. The challenge is securely sharing the key between parties.

Algorithms: AES-128/256, ChaCha20, Blowfish, 3DES
Asymmetric

Public-Private Key Pair

Asymmetric encryption uses a mathematically linked key pair: a public key for encryption and a private key for decryption. RSA and Ed25519 solve the key distribution problem but are slower than symmetric encryption. Typically used to exchange symmetric keys.

Algorithms: RSA-2048/4096, Ed25519, ECDSA, X25519

Hash Functions

A hash function takes arbitrary-length input and produces a fixed-size output (the "digest" or "hash"). Cryptographic hash functions have three critical properties: preimage resistance (you cannot reverse the hash), second preimage resistance (you cannot find a different input with the same hash), and collision resistance (you cannot find any two inputs with the same hash).

SHA-2 Family

SHA-256 and SHA-512 are the current standard. Used in Bitcoin, TLS, digital signatures, and data integrity. Considered secure against all known attacks.

HMAC

Hash-based Message Authentication Code combines a hash function with a secret key to verify both integrity and authenticity of a message.

MD5 (Legacy)

Broken since 2004 — collisions can be generated in seconds. Only suitable for non-security checksums. Never use for password hashing or digital signatures.

Encoding Standards

Encoding is not encryption — it is a way to represent data in a different format. Encoding is reversible and does not require a key. These standards are essential for data interchange between systems.

Encoding

Base64

Converts binary data to ASCII text using 64 characters. Used in email, data URLs, and embedding binary data in JSON.

Encoding

URL Encoding

Encodes special characters in URLs using percent-encoding (%20 for space, %2F for slash). Essential for query parameters and form data.

Identifier

UUID / NanoID / ULID

Unique identifiers for database keys, API tokens, and session management. Each format has different trade-offs in size, randomness, and sortability.

Algorithm Comparison Table

Algorithm Type Output Size Use Case Status
SHA-256 Hash 256 bits Data integrity, signatures, Bitcoin Secure
SHA-512 Hash 512 bits High-security integrity verification Secure
MD5 Hash 128 bits Non-security checksums only Broken
AES-256-GCM Symmetric 256-bit key Bulk data encryption, TLS, disk encryption Secure
ChaCha20-Poly1305 Symmetric 256-bit key Mobile/embedded encryption, TLS 1.3 Secure
RSA-2048 Asymmetric 2048-bit key Key exchange, digital signatures Secure
Ed25519 Asymmetric 256-bit key SSH keys, modern signatures, faster than RSA Secure
HMAC-SHA256 MAC 256 bits API authentication, webhook verification Secure

Frequently Asked Questions

What is cryptography?
Cryptography is the practice and study of techniques for secure communication in the presence of adversarial behavior. It encompasses encryption, hashing, digital signatures, and key exchange — the mathematical foundations that protect data confidentiality, integrity, and authenticity.
What is the difference between encryption and hashing?
Encryption is reversible — it transforms plaintext into ciphertext using a key, and the original data can be recovered with the correct decryption key. Hashing is one-way — it produces a fixed-size fingerprint from input data that cannot be reversed. Encryption protects confidentiality; hashing ensures integrity.
Is MD5 secure for password hashing?
No. MD5 is cryptographically broken — collisions can be generated in seconds, and it is too fast for password hashing. Use bcrypt, scrypt, or Argon2 for passwords. MD5 still has legitimate uses for non-security checksums and file identification.
What is SHA-256?
SHA-256 is a cryptographic hash function in the SHA-2 family that produces a 256-bit (32-byte) digest. It is used in Bitcoin mining, TLS certificates, digital signatures, and data integrity verification. It is currently considered secure against collision and preimage attacks.
What is Base64 encoding?
Base64 encodes binary data into a printable ASCII string using 64 characters (A-Z, a-z, 0-9, +, /). It is not encryption — it is simply a way to represent binary data in text format. Common uses include embedding images in HTML/CSS, email attachments, and data URLs.
What is the difference between symmetric and asymmetric encryption?
Symmetric encryption uses one shared key for both encryption and decryption (AES, ChaCha20). It is fast but requires secure key exchange. Asymmetric encryption uses a key pair — public key for encryption, private key for decryption (RSA, Ed25519). It solves the key distribution problem but is slower.
What is a UUID?
A UUID (Universally Unique Identifier) is a 128-bit identifier designed to be unique across all devices and time. Version 4 UUIDs are random and used for database keys, API identifiers, and session tokens. ULIDs and NanoIDs are modern alternatives with different trade-offs.
🛡️

GeneratePass Editorial Team

Verified Author

The GeneratePass Editorial Team is comprised of security researchers, cryptography enthusiasts, and software engineers dedicated to making browser-based cryptographic tools accessible and secure. We write guides with a focus on local execution, zero-trust patterns, and client-side data sovereignty.

Focus: Cryptography Standard: zero-trust