Web3

Web3

Cryptographic Primitives for Humans: Hashes, Signatures, and Keys Explained Clearly

November 17, 2025

7

min read

You're reading about blockchain. Every explanation mentions "cryptographic hashes." You're evaluating a security product. The documentation references "digital signatures" and "public key cryptography." You're trying to understand how wallets work. Everything relies on "private keys."

These aren't optional concepts anymore. If you work in Web3, security, or any technical field touching authentication or data integrity, you need to understand cryptographic primitives.

Not at a mathematician's level. At a functional level. What they do, why they matter, how they work conceptually, and when they fail.

This guide explains the three fundamental cryptographic building blocks (hash functions, digital signatures, and cryptographic keys) in plain language, without advanced math, but with enough depth to be useful.

Why Cryptographic Primitives Matter

Every secure system you use relies on these three concepts:

Hash functions verify data hasn't been tampered with.

  • File downloads (checksums)

  • Blockchain blocks

  • Password storage

  • Git commits

  • Data deduplication

Digital signatures prove who sent a message and that it wasn't altered.

  • Software updates (code signing)

  • Cryptocurrency transactions

  • Smart contracts

  • SSL/TLS certificates

  • Document signing

Cryptographic keys enable secure communication and authentication.

  • HTTPS (securing web traffic)

  • SSH (remote server access)

  • Cryptocurrency wallets

  • Encrypted messaging

  • VPNs

Understanding these primitives is like understanding inputs, outputs, and constraints for systems. They're the foundational building blocks. Everything else is built on top.

Hash Functions: Digital Fingerprints

A hash function takes any input (text, file, data) and produces a fixed-size output called a hash. The same input always produces the same hash. Different inputs (almost always) produce different hashes.

What Hash Functions Actually Do

The basic operation:


Properties:

Fixed output size:

  • No matter how large the input, output is always the same length

  • SHA-256 always produces 256 bits (64 hexadecimal characters)

  • 1 byte input → 64 character hash

  • 1 gigabyte input → 64 character hash

Deterministic:

  • Same input always produces same output

  • "Hello" always hashes to the same value

  • Completely predictable

One-way (preimage resistance):

  • Given a hash, you cannot reverse it to find the original input

  • Hash reveals nothing about the input

  • Only way to find input is trying every possibility (brute force)

Collision resistance:

  • Extremely difficult to find two different inputs that produce the same hash

  • For SHA-256: 2^256 possible hashes (more than atoms in the universe)

  • Probability of random collision: effectively zero

Avalanche effect:

  • Tiny change in input produces completely different hash

  • Change one letter: entirely different output

  • Cannot predict how hash changes

Example of avalanche effect:


Completely different. No similarity. No way to predict the change.

Common Hash Functions

MD5 (128 bits)

  • Status: Broken, do not use

  • Collision attacks exist (can create two different files with same hash)

  • Still used for non-security purposes (checksums)

  • Never use for security

SHA-1 (160 bits)

  • Status: Deprecated, avoid

  • Collision attacks demonstrated in 2017

  • Being phased out across industry

  • Use SHA-256 instead

SHA-256 (256 bits)

  • Status: Strong, widely used

  • Part of SHA-2 family

  • Bitcoin and most blockchains use this

  • No known attacks

  • Industry standard

SHA-3 (variable length)

  • Status: Strong, newer

  • Different algorithm family than SHA-2

  • NIST standard as of 2015

  • Used when SHA-2 might eventually be compromised

BLAKE2/BLAKE3

  • Status: Strong, fast

  • Faster than SHA-256

  • Used in some newer systems

  • Gaining adoption

Real-World Hash Function Applications

Application 1: Password Storage

Wrong way to store passwords:

Problem: Database breach exposes all passwords.

Right way to store passwords:

How it works:

  1. User creates account with password "password123"

  2. System hashes password: SHA-256("password123") = ef92b778...

  3. System stores hash, not password

  4. When user logs in, system hashes input and compares to stored hash

  5. If hashes match, password is correct

Security benefit:

  • Database breach exposes hashes, not passwords

  • Hashes can't be reversed to reveal passwords

  • Attacker must try every possible password (very slow with salting)

Note: Real systems add "salt" (random data) to prevent rainbow table attacks, but concept is the same.

Application 2: File Integrity Verification

Problem: How do you know a downloaded file wasn't corrupted or tampered with?

Solution: Compare hashes.

Process:

  1. Software vendor publishes file and its hash

  2. You download the file

  3. You compute hash of downloaded file

  4. Compare your hash to published hash

  5. If they match: file is intact and authentic

  6. If they differ: file was corrupted or modified

Example:


Application 3: Blockchain

How blockchain uses hashes:

Each block contains:

  • Transaction data

  • Timestamp

  • Hash of previous block

  • Its own hash (computed from all above)

Example:


Why this matters:

  • If anyone changes Block 1 data, Block 1 hash changes

  • Block 2 contains Block 1 hash, so Block 2 is now invalid

  • All subsequent blocks become invalid

  • Tampering is immediately detectable

This creates an immutable chain. You can't change history without breaking the entire chain.

Application 4: Git Version Control

Every commit in Git is identified by a hash.


The hash is computed from:

  • File changes

  • Commit message

  • Author and timestamp

  • Parent commit hash

Why this matters:

  • Commit hashes are unique identifiers

  • Can't change commit without changing hash

  • History is tamper-evident

  • Distributed repositories can verify integrity

When Hash Functions Fail

Collision attacks:

Theory: Finding two inputs that produce the same hash.

SHA-1 collision (2017): Researchers created two different PDF files with identical SHA-1 hashes. This proved SHA-1 is broken for security purposes.

Impact:

  • Can create malicious file with same hash as legitimate file

  • Digital signatures become unreliable

  • Code signing can be forged

Defense: Use SHA-256 or newer. Collision attacks on SHA-256 are not practical with current technology.

Preimage attacks:

Theory: Given a hash, find ANY input that produces it.

No practical attacks exist on SHA-256 for preimage resistance.

Birthday attacks:

Theory: Find any collision (not a specific one) requires trying ~2^(n/2) inputs where n is hash size.

For SHA-256: Would require trying 2^128 hashes (still computationally infeasible).

Practical implication: Hash functions with output smaller than 256 bits are becoming questionable for long-term security.

Digital Signatures: Cryptographic Proof of Authorship

A digital signature proves two things:

  1. The message came from a specific person (authentication)

  2. The message wasn't altered since they signed it (integrity)

This is different from encryption. Encryption hides content. Signatures prove origin and integrity, but content is visible.

How Digital Signatures Work

Components:

Private Key: Secret key only you know. Used to create signatures. Public Key: Public key everyone can know. Used to verify signatures. Message: The data being signed. Signature: Cryptographic proof created with private key.

Signing process:

  1. Alice writes message: "Send 10 BTC to Bob"

  2. Alice computes hash of message: SHA-256("Send 10 BTC to Bob") = hash

  3. Alice encrypts hash with her private key = signature

  4. Alice publishes: message + signature

Verification process:

  1. Bob receives: message + signature

  2. Bob computes hash of message

  3. Bob decrypts signature using Alice's public key = original hash

  4. Bob compares: computed hash vs. decrypted hash

  5. If match: Signature is valid (Alice signed it, message unchanged)

  6. If mismatch: Either signature is invalid or message was tampered with

Why this works:

Only Alice can create valid signatures because only she has her private key.

Anyone can verify signatures because public key is public.

Signatures prove message wasn't altered because any change to message changes hash, breaking signature verification.

Real-World Digital Signature Applications

Application 1: Cryptocurrency Transactions

Problem: How do you prove you own Bitcoin and authorize a transaction?

Solution: Digital signatures.

Process:


Security properties:

  • Only Alice can create valid signature (only she has private key)

  • Anyone can verify transaction is from Alice (public key is public)

  • Can't change amount or recipient without invalidating signature

  • Can't replay old transactions (signatures include transaction nonce/timestamp)

This is how cryptocurrency works without a central authority. Signatures prove ownership without needing a bank to verify identity.

Application 2: Software Code Signing

Problem: How do you know downloaded software comes from legitimate developer and wasn't tampered with?

Solution: Code signing with digital signatures.

Process:


Why this matters:

  • Prevents malware from impersonating legitimate software

  • Ensures updates come from actual vendor

  • Creates chain of trust

  • macOS, Windows, iOS all require code signing for many contexts

Application 3: SSL/TLS Certificates

Problem: How do you know you're actually connected to bank.com and not a fake site?

Solution: SSL/TLS certificates signed by Certificate Authorities.

Process:


This prevents man-in-the-middle attacks. Even if attacker intercepts traffic, they can't forge a certificate with valid CA signature.

Application 4: Smart Contract Execution

In Ethereum and other smart contract platforms:

Every transaction that calls a smart contract function must be signed.


Why this matters:

  • Proves user authorized the action

  • Prevents anyone else from calling functions on user's behalf

  • Creates audit trail of who did what

  • Enables trustless execution

When Digital Signatures Fail

Private key compromise:

If private key is stolen or leaked:

  • Attacker can create valid signatures

  • No way to distinguish legitimate from fraudulent signatures

  • All signatures become untrusted

Solution:

  • Key revocation (certificate revocation lists)

  • Issue new key pair

  • Alert ecosystem that old key is compromised

Weak random number generation:

Some signature schemes require random numbers.

If randomness is weak or reused:

  • Private key can be derived from signatures

  • PlayStation 3 hack (2010): Sony reused random value, hackers extracted private key

  • Multiple Bitcoin wallets compromised same way

Solution: Use cryptographically secure random number generators.

Signature malleability:

Some signature schemes allow creating different valid signatures for same message.

Bitcoin had this issue:

  • Could modify signature slightly while keeping it valid

  • Changed transaction ID

  • Caused issues with transaction tracking

Solution: Modern signature schemes (Schnorr, EdDSA) are non-malleable.

Cryptographic Keys: The Foundation of Everything

Cryptographic keys are large numbers used in cryptographic operations. Everything in modern cryptography relies on keys.

Symmetric vs. Asymmetric Cryptography

Symmetric Cryptography (One Key)

Concept: Same key encrypts and decrypts.

Example: AES (Advanced Encryption Standard)


Properties:

  • Fast (can encrypt gigabytes quickly)

  • Simple (one key for both operations)

  • Key distribution problem (how do both parties get the key securely?)

Use cases:

  • Encrypting files on disk

  • Encrypting database contents

  • VPN tunnel encryption (after key exchange)

Asymmetric Cryptography (Two Keys)

Concept: Public key encrypts, private key decrypts (or vice versa for signatures).

Example: RSA


Properties:

  • Slower than symmetric (100-1000x slower)

  • Solves key distribution (public key can be shared openly)

  • Enables signatures (prove authorship)

Use cases:

  • SSL/TLS (establish secure connection)

  • Cryptocurrency (prove ownership)

  • Digital signatures (prove authenticity)

  • Encrypted email (PGP/GPG)

How Key Pairs Work

Mathematical relationship:

Public and private keys are mathematically related but:

  • Private key cannot be derived from public key (one-way function)

  • Public key is derived from private key (deterministic)

For RSA:

  • Private key: Two large prime numbers (p and q)

  • Public key: Their product (n = p × q) plus exponent (e)

  • Easy to multiply primes: p × q = n

  • Hard to factor: Given n, find p and q (infeasible for large numbers)

For Elliptic Curve (ECC):

  • Private key: Random large number (d)

  • Public key: Point on curve (Q = d × G where G is generator point)

  • Easy to multiply: d × G = Q

  • Hard to reverse: Given Q and G, find d (discrete logarithm problem)

Security relies on mathematical hardness. These operations are easy in one direction, virtually impossible in reverse.

Key Sizes and Security

Bigger keys = more security, but diminishing returns.

Symmetric keys:

  • 128 bits: Strong (AES-128)

  • 256 bits: Very strong (AES-256)

  • Brute force: Must try 2^n possible keys

  • 128-bit key: 2^128 = 340,282,366,920,938,463,463,374,607,431,768,211,456 possibilities

Asymmetric keys (RSA):

  • 1024 bits: Broken (2010)

  • 2048 bits: Minimum acceptable

  • 3072 bits: Recommended

  • 4096 bits: Very strong

  • Larger keys needed because factoring algorithms are more efficient than brute force

Elliptic Curve keys:

  • 256 bits: Equivalent to RSA 3072 bits

  • Much smaller keys for same security level

  • Faster computations

  • Used in Bitcoin, Ethereum, modern TLS

Comparison:


Elliptic Curve provides same security with much smaller keys. This is why modern systems prefer ECC.

Real-World Key Management

Problem: Where do you store private keys?

If private key is lost: Cannot decrypt data, cannot sign transactions, cannot access cryptocurrency.

If private key is stolen: Attacker has full control, can impersonate you, can steal funds.

Storage options:

Hot Wallet (Software Storage):

  • Private key stored on internet-connected device

  • Convenient (easy access)

  • Less secure (vulnerable to malware, hacking)

  • Use for: Small amounts, frequent transactions

Cold Wallet (Offline Storage):

  • Private key stored on offline device

  • Less convenient (must connect to sign)

  • More secure (not vulnerable to remote attacks)

  • Use for: Large amounts, long-term storage

Hardware Wallet:

  • Private key stored on specialized device (Ledger, Trezor)

  • Never leaves device (signs transactions internally)

  • Medium convenience

  • High security (dedicated secure hardware)

  • Use for: Moderate to large amounts

Paper Wallet:

  • Private key printed on paper

  • Very inconvenient (must type to use)

  • Secure from digital attacks

  • Vulnerable to physical loss/damage

  • Use for: Long-term cold storage

Key Derivation (HD Wallets):

Problem: Managing hundreds of key pairs is cumbersome.

Solution: Hierarchical Deterministic (HD) wallets.

How it works:


Benefit: Backup single seed phrase, recover all keys.

Example (BIP39):


This is why cryptocurrency wallets show 12-24 word phrases. Those words encode the master seed.

When Keys Fail

Insufficient randomness:

Keys must be generated from truly random data.

If randomness is weak:

  • Attacker can predict keys

  • Multiple users might generate same key

  • Private keys can be brute forced

Example: Early Bitcoin wallets with weak random number generators led to key prediction and fund theft.

Side-channel attacks:

Keys can leak through physical characteristics:

  • Timing attacks (how long operations take reveals key bits)

  • Power analysis (power consumption during crypto operations reveals key)

  • Electromagnetic emission (radiation from device reveals operations)

Defense: Constant-time implementations, hardware countermeasures.

Quantum computing:

Current threat: None (quantum computers not powerful enough yet)

Future threat: Large-scale quantum computers can break RSA and current elliptic curves.

Timeline: Unknown, possibly 10-30 years

Defense: Post-quantum cryptography (algorithms resistant to quantum attacks)

NIST is standardizing post-quantum algorithms now in anticipation.

How These Primitives Work Together

Real systems combine all three primitives.

Example: Sending Encrypted and Signed Email (PGP)

Scenario: Alice sends encrypted email to Bob.

Process:

1. Alice writes message

2. Symmetric encryption of message


3. Asymmetric encryption of symmetric key


4. Sign the encrypted message


5. Send package to Bob

6. Bob decrypts and verifies


Why this approach:

  • Symmetric encryption is fast (for large messages)

  • Asymmetric encryption solves key distribution (for small AES key)

  • Signature proves authenticity and integrity

  • Hash makes signature efficient (sign hash, not entire message)

All three primitives working together.

Example: Blockchain Transaction

Scenario: Alice sends cryptocurrency to Bob.

Process:

1. Create transaction


2. Hash transaction

3. Sign transaction hash

4. Broadcast to network

5. Network verification


6. Block creation


Primitives in use:

  • Hash functions: Transaction IDs, block IDs, Merkle trees

  • Digital signatures: Prove transaction authorization

  • Keys: Alice's private key to sign, public key to verify

Practical Understanding for Non-Cryptographers

You don't need to implement cryptography (don't implement crypto yourself, use established libraries). You need to understand:

What these primitives do:

  • Hashes: Fingerprints for data integrity

  • Signatures: Proof of authorship and integrity

  • Keys: Enable encryption and signatures

When to use each:

  • Need integrity check: Hash

  • Need to prove sender: Signature

  • Need secrecy: Encryption (symmetric for data, asymmetric for key exchange)

Common failure modes:

  • Weak keys (insufficient randomness, too small)

  • Algorithm vulnerabilities (MD5, SHA-1 broken)

  • Implementation bugs (timing attacks, side channels)

  • Key management failures (lost keys, stolen keys)

How to evaluate systems:

  • What algorithms are used? (modern = SHA-256+, not MD5/SHA-1)

  • What key sizes? (RSA 2048+ or ECC 256+)

  • How are keys managed? (hardware wallets, HSMs, or just software?)

  • What's the threat model? (what attacks is it protecting against?)

Common Misconceptions

"Encryption and hashing are the same thing."

Wrong. Encryption is reversible (decrypt to get original). Hashing is one-way (cannot reverse).

"Longer passwords are more secure because they produce longer hashes."

Wrong. Hash output is fixed length regardless of input. Password "a" and password "verylongpasswordhere" both produce 256-bit SHA-256 hashes.

Longer passwords ARE more secure (harder to brute force), but not because of hash length.

"If I have someone's public key, I can decrypt their messages."

Wrong. Public key encrypts, private key decrypts. Public key cannot decrypt what it encrypted.

For signatures: Public key verifies, private key signs. Public key cannot create signatures.

"Digital signatures encrypt the message."

Wrong. Signatures prove authenticity and integrity. Message is still readable. If you want encryption AND signatures, do both separately.

"Cryptocurrency private keys are stored on the blockchain."

Wrong. Only public keys (addresses) are on blockchain. Private keys are stored by users locally. Blockchain never sees private keys.

Your Action Plan: Building Cryptographic Literacy

Week 1: Understand hashes

  • Use online SHA-256 calculator

  • Hash the same input multiple times (see deterministic output)

  • Change one character and hash again (see avalanche effect)

  • Verify download checksums for software you download

Week 2: Understand signatures

  • Generate PGP key pair (use GPG)

  • Sign a message

  • Verify your own signature

  • Share public key, let someone verify your signature

Week 3: Understand keys

  • Generate cryptocurrency wallet (testnet)

  • Understand seed phrase = master key

  • Create multiple addresses from one seed

  • Make testnet transaction, observe signature

Week 4: See them combined

  • Examine SSL certificate in browser

  • Inspect blockchain transaction on block explorer

  • Look at Git commit hashes

  • Verify software signature

Total time: 4-6 hours across 4 weeks

Outcome: Functional understanding of cryptographic primitives.

For Web3 and Security Professionals

If you work in Web3 or security, deep understanding of these primitives is essential.

Smart contract security:

  • Hash collisions can break signature schemes

  • Signature malleability creates vulnerabilities

  • Weak randomness compromises private keys

Wallet security:

  • Key generation must be cryptographically secure

  • Seed phrase storage is critical

  • Hardware wallets protect against key extraction

Protocol design:

  • Choice of hash function matters (SHA-256 vs alternatives)

  • Signature scheme affects performance and security

  • Key derivation paths must be standardized

Audit criteria:

  • Is randomness from secure source?

  • Are deprecated algorithms used? (MD5, SHA-1, small RSA keys)

  • Are keys properly protected?

  • Is signature verification implemented correctly?

Common vulnerabilities:

  • Using Math.random() for cryptographic operations (not cryptographically secure)

  • Storing private keys in plaintext

  • Reusing nonces in signatures

  • Not validating signature verification results

Final Thoughts: Cryptography is Foundational

You can build on top of cryptographic primitives without understanding them. Many developers do.

But if you work in security, blockchain, or any field where trust and integrity matter, superficial knowledge isn't enough.

Understanding hash functions helps you verify data integrity, spot collision vulnerabilities, and design tamper-evident systems.

Understanding digital signatures helps you implement authentication, evaluate signature schemes, and prevent impersonation.

Understanding cryptographic keys helps you protect secrets, manage credentials, and avoid catastrophic key compromise.

These aren't abstract concepts. They're tools you use every day, whether you know it or not.

The companies building the most secure systems understand these primitives deeply. The ones getting hacked often don't.

Which side do you want to be on?

Written by Julian Arden

Written by Julian Arden

Subscribe to my
newsletter

Get new travel stories, reflections,
and photo journals straight to your inbox

By subscribing, you agree to the Privacy Policy

Subscribe to my
newsletter

Get new travel stories, reflections,
and photo journals straight to your inbox

By subscribing, you agree to the Privacy Policy

Subscribe
to my

newsletter

Get new travel stories, reflections,
and photo journals straight to your inbox

By subscribing, you agree to the Privacy Policy