You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Blockchain technology is built on a foundation of cryptographic primitives. Understanding hashing, digital signatures, and Merkle trees is essential to grasping how blockchains achieve security, integrity, and trustlessness.
A hash function takes an input of any size and produces a fixed-size output (the hash or digest). In blockchain, hash functions serve as the backbone of data integrity.
| Property | Description |
|---|---|
| Deterministic | The same input always produces the same output |
| Fixed output size | Regardless of input size, the hash is always the same length |
| Pre-image resistance | Given a hash, it is computationally infeasible to find the original input |
| Second pre-image resistance | Given an input, it is infeasible to find a different input with the same hash |
| Collision resistance | It is infeasible to find any two different inputs that produce the same hash |
| Avalanche effect | A tiny change in input produces a drastically different output |
SHA-256 is the hash function used by Bitcoin. It always produces a 256-bit (32-byte) output:
Input: "Hello"
SHA-256: 185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969
Input: "Hello!"
SHA-256: 334d016f755cd6dc58c53a86e183882f8ec14f52fb05345887c8a5edd42c87b7
Notice how adding a single character completely changes the hash — this is the avalanche effect.
| Blockchain | Hash Function | Output Size |
|---|---|---|
| Bitcoin | SHA-256 (double hashed) | 256 bits |
| Ethereum | Keccak-256 | 256 bits |
| Litecoin | Scrypt (memory-hard) | 256 bits |
| Zcash | Equihash | Variable |
| IOTA | Curl-P / Kerl | 243 trits |
Note: Ethereum uses Keccak-256, which is closely related to but not identical to the NIST SHA-3 standard. The difference is in the padding scheme.
Digital signatures allow blockchain participants to prove ownership of their funds and authorise transactions without revealing their private key.
1. Sender hashes the transaction data
2. Sender signs the hash with their private key --> Signature
3. Transaction + Signature are broadcast to the network
4. Validators verify the signature using the sender's public key
Bitcoin and Ethereum both use ECDSA with the secp256k1 curve:
| Parameter | Value |
|---|---|
| Curve | secp256k1 |
| Private key size | 256 bits (32 bytes) |
| Public key size | 512 bits uncompressed / 257 bits compressed |
| Signature size | ~512 bits (two 256-bit integers: r, s) |
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.