← Back to All Guides
Cryptography & Security • 9 min read • September 18, 2026

Modern Web Cryptography: Understanding Hashing, Symmetric Encryption, and Public-Key RSA

An accessible technical guide to cryptographic primitives: SHA-256 vs MD5 collisions, AES-GCM 256-bit ciphers with PBKDF2 salts, and asymmetric RSA keypairs.

By ToolHero Cryptography Research Team

Cryptography on the Modern Web: Beyond Jargon

Every secure transaction on the internet—from HTTPS padlock connections and password storage to encrypted messaging and digital signatures—relies on a small set of well-defined mathematical operations known as cryptographic primitives.

Many developers and users confuse Encoding, Hashing, and Encryption. Understanding these distinctions is fundamental:

┌────────────────────────────────────────────────────────────────────────┐
│                        CRYPTOGRAPHIC PRIMITIVES                        │
├─────────────────┬─────────────────────┬────────────────────────────────┤
│ Operation       │ Reversible?         │ Primary Purpose                │
├─────────────────┼─────────────────────┼────────────────────────────────┤
│ Encoding    │ Yes (No key needed) │ Data representation (Base64)   │
│ Hashing     │ No (One-way)        │ Integrity, Passwords (SHA-256) │
│ Symmetric   │ Yes (Same key)      │ Confidentiality (AES-GCM)      │
│ Asymmetric  │ Yes (Keypair)       │ Identity, Key Exchange (RSA)   │
└─────────────────┴─────────────────────┴────────────────────────────────┘

1. Cryptographic Hash Functions: One-Way Fingerprints

A cryptographic hash function takes an arbitrary-length input (a word, a password, or a 10GB ISO file) and produces a deterministic, fixed-size output string known as a hash digest.

Key Properties of Secure Hash Functions

  • Pre-image Resistance (One-Way): Given a hash digest H, it is computationally infeasible to determine the original input M.
  • Avalanche Effect: Changing a single bit in the input causes an unpredictable cascade, drastically altering more than 50% of the output bits.
  • Collision Resistance: It is mathematically infeasible to find two distinct inputs $M_1
  • eq M_2 such that H(M_1) = H(M_2)$.

    Why Legacy Hashes (MD5 & SHA-1) Are Broken

  • MD5 (128-bit): In 2004, researchers demonstrated practical collision attacks. Today, modern GPUs can generate identical MD5 collisions in seconds. MD5 should never be used for digital signatures or security certificates.
  • SHA-1 (160-bit): Broken in 2017 by Google and CWI Amsterdam (the SHAttered attack). Deprecated across all web browsers and industry standards.
  • SHA-256 / SHA-3 (Current Gold Standard): Part of the SHA-2 family, SHA-256 produces a 256-bit (64 hexadecimal characters) digest. With 2^{256} possible combinations—more than the estimated number of atoms in the observable universe—SHA-256 remains completely secure against brute-force collision attacks.

  • 2. Symmetric Encryption: AES-256-GCM

    When you need to protect confidential text or files so that only authorized parties can decrypt them, you use symmetric encryption. The sender and recipient share a single secret key.

    Why AES-GCM (Galois/Counter Mode) Is Superior

    Older symmetric encryption implementations commonly used AES-CBC (Cipher Block Chaining). However, CBC only provides confidentiality, making it vulnerable to padding oracle attacks (such as POODLE) if an attacker tampers with ciphertexts in transit.

    AES-GCM provides Authenticated Encryption with Associated Data (AEAD):

  • Confidentiality: Scrambles data using the Advanced Encryption Standard (AES) with a 256-bit key.

  • Integrity & Authentication: Generates an authentication tag (typically 128-bit). If an attacker modifies even one byte of the encrypted payload, decryption immediately fails, preventing tampering attacks.
  • The Crucial Role of Salt and Key Derivation (PBKDF2)

    Humans remember passwords (e.g., SecretPassphrase123!), not 256-bit random hexadecimal keys. To securely convert a human passphrase into an AES key:
  • A random Salt (at least 16 bytes) is generated.
  • A Key Derivation Function (such as PBKDF2 with 100,000+ iterations or Argon2id) repeatedly hashes the password and salt, making brute-force dictionary attacks with hardware ASICs computationally impractical.

  • 3. Asymmetric Encryption: RSA Keypairs

    In symmetric encryption, the sender and recipient must somehow secretly exchange the key first. But how do you exchange a secret across an untrusted public internet?

    The answer is Public-Key (Asymmetric) Cryptography, invented by Rivest, Shamir, and Adleman (RSA):

    • Key Generation: A user generates two mathematically linked keys:
    • * Public Key: Shared openly with the world. Anyone can use it to encrypt a message for you. * Private Key: Guarded securely on your local device. Only this key can decrypt messages encrypted with your public key.
    • Digital Signatures: The reverse operation enables non-repudiation. You sign a document hash with your Private Key, and anyone with your Public Key can mathematically verify that the document was signed by you and has not been altered.

    Recommended RSA Key Sizes

  • 1024-bit: Broken / Deprecated. Do not use.
  • 2048-bit: Current industry minimum standard. Secure for general use through 2030.
  • 4096-bit: Recommended for high-security, long-term archival root certificates and financial infrastructure.

  • How ToolHero Executes Client-Side Cryptography

    ToolHero's Crypto Studio, Hash Identifier, and RSA Key Generator leverage the browser's native Web Cryptography API (window.crypto.subtle):

    • Keys are generated using cryptographically secure hardware pseudorandom number generators (crypto.getRandomValues).
    • AES-GCM encryption runs entirely within isolated browser memory threads.
    • Private keys and decrypted plaintexts are never transmitted over the network, protecting you from man-in-the-middle attacks and cloud breaches.

    Frequently Asked Questions

    What is the primary difference between hashing and encryption?

    Hashing is a one-way mathematical function designed for integrity verification or password storage (you cannot reverse a hash back to its input). Encryption is a two-way transformation requiring a secret key to decrypt back into original plaintext.

    Why should a cryptographic salt always be used when hashing passwords?

    A unique cryptographic salt ensures that identical passwords yield completely different hashes, neutralizing precomputed rainbow table attacks and bulk hash lookup collisions.

    Why is AES-GCM preferred over AES-CBC in modern web applications?

    AES-GCM provides authenticated encryption (AEAD), which guarantees both confidentiality and ciphertext integrity. This prevents padding oracle attacks and bit-flipping tampering that plague unauthenticated CBC mode.

    Put This Theory Into Practice

    Experience zero-upload, client-side processing with ToolHero suite of free online utilities.

    Explore All Free Tools →