Cryptography and hashing in blockchain
This is Cryptography and hashing in blockchain

One of the most common questions for learners is:
👉 How is blockchain secure?
👉 What makes it trustworthy and tamper-proof?
The answer lies in two foundational technologies:
- Cryptography
- Hashing
Together, they make blockchain immutable, verifiable, and resistant to fraud or unauthorized manipulation. Let’s break this down in detail.
1. Cryptography in Blockchain
What is Cryptography?
Cryptography is the science of protecting information from unauthorized access or modification. In blockchain, it ensures that:
- Only intended participants can access transaction details.
- Transactions are authentic (created by the rightful owner).
- Data is tamper-proof and consistent across the network.
The term comes from Greek:
• Kryptos → “hidden”
• Graphein → “to write”
Thus, cryptography literally means hidden writing.
Roles of Cryptography in Blockchain
In a blockchain network, cryptography is used to:
- Secure transactions between nodes.
- Protect user privacy and identities.
- Prevent double-spending (same asset being spent twice).
- Validate digital signatures of transactions.
- Keep the public blockchain safe despite being open and decentralized.
Blockchain applies two major cryptographic methods:
- Symmetric Cryptography (Secret-Key Cryptography)
- Asymmetric Cryptography (Public-Key Cryptography)
1.1 Symmetric-Key Cryptography
In symmetric encryption, the same key is used for both encryption and decryption.
• Example: AES (Advanced Encryption Standard), DES (Data Encryption Standard)
Features:
- Fast and efficient → good for bulk encryption.
- Both sender and receiver must securely share the secret key.
- Used for securing data at rest or private communications.
⚠️ Limitation: Key distribution is difficult in a decentralized system, which is why asymmetric cryptography is preferred in blockchain.
1.2 Asymmetric-Key Cryptography
In asymmetric encryption, two mathematically linked keys are used:
• Public Key → shared openly, used to encrypt data or verify a signature.
• Private Key → kept secret, used to decrypt data or sign transactions.
Examples: RSA, ECC (Elliptic Curve Cryptography), DSS
Features:
- Known as Public-Key Cryptography.
- Enables digital signatures and wallet addresses.
- Slower than symmetric cryptography but essential for decentralized trust.
Wallets and Digital Signatures
- A Blockchain Wallet doesn’t store currency itself. Instead, it stores private keys and manages transactions.
- When a user sends cryptocurrency, they generate a digital signature using their private key.
- Other nodes verify the transaction using the sender’s public key.
This guarantees:
✅ The sender really authorized the transaction.
✅ Data hasn’t been tampered with.
✅ Hackers can’t forge signatures.
Example
- Alice creates a transaction stating: “I am sending 2 BTC to Bob’s address.”
- She signs the transaction using her private key.
- Miners/validators use Alice’s public key to verify that the signature is authentic.
- Once validated, the transaction is added to the blockchain.
This ensures authenticity, non-repudiation, and trust without needing a central authority.
2. Hashing in Blockchain
What is Hashing?
Hashing is a mathematical process that converts data of any size into a fixed-length string (hash value).
Example (SHA-256):
• Input: Hello
• Hash: 185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969
Notice:
- The same input always gives the same output.
- A tiny change in input drastically changes the hash.
Properties of Cryptographic Hash Functions
- Deterministic → Same input = Same output.
- Avalanche Effect → Small input change = Big hash change.
- Collision Resistance → Two inputs shouldn’t produce the same hash.
- Irreversibility → You cannot get original data from a hash.
- Fast Computation → Easy to compute, even for large data.
Example:
• Input: Hello World → Hash: a591...d8c
• Input: Hello world → Hash: 64ec...f89d
(Just the capital “W” vs lowercase “w” completely changes the result).
Role of Hashing in Blockchain
- Block Integrity: Every block has its own unique hash.
- Chaining Blocks: Each block stores the hash of the previous block, linking them.
- Immutability: Changing any transaction changes the hash, breaking the chain.
- Proof of Work: Mining involves finding a hash value below a target threshold.
Example: Merkle Tree
In Bitcoin and Ethereum, multiple transactions inside a block are hashed together into a Merkle Tree.
- Each transaction → hashed.
- Combined hashes → Merkle Root.
- Merkle Root → stored in the block header.
This allows efficient verification of transactions without downloading the entire block.
3. Benefits of Cryptography & Hashing in Blockchain
- Encryption → Protects data and communications.
- Immutability → Ensures records cannot be altered once stored.
- Security → Prevents tampering and fraud.
- Scalability → Supports irreversible and verifiable transactions at scale.
- Non-repudiation → Digital signatures prevent denial of transactions.
- Anti-hacking → Any change in data invalidates digital signatures and hashes.
4. Limitations of Cryptography in Blockchain
- Complex Access: Strong encryption can make even legitimate access difficult in emergencies.
- No Defense Against Bad Design: Weak protocols or poor coding can still expose vulnerabilities.
- High Cost: Public-Key Infrastructure (PKI) requires investment in setup and maintenance.
- Performance Overheads: Cryptography can slow down transaction processing.
- Future Vulnerabilities: Advances in computing (e.g., quantum computing) may break current algorithms.
5. Putting It All Together
Blockchain security is built on cryptography (digital signatures, key management) and hashing (immutability, block linking).
- She signs the transaction with her private key (cryptography).
- The transaction is broadcast and hashed (hashing).
- Validators verify her signature with her public key.
- Once approved, the transaction is added to a block.
- The block is hashed and linked to the chain, making it immutable.
Summary:
Without cryptography and hashing, blockchain would just be another distributed database. With them, it becomes a trustless, secure, and decentralized system powering cryptocurrency and beyond.
Test Your Knowledge
Practice what you've learned with these quizzes related to What is Blockchain?.
Continue Learning
Explore more topics in What is Blockchain? or browse other tutorials.