Unit 3: Hash Functions, Cryptography, and Digital Signatures in Blockchain
Unit 3: Hash Functions, Cryptography, and Digital Signatures in
Blockchain
1. Hash Function in Blockchain
A hash function is a
cryptographic algorithm that converts any input data into a fixed-size, unique
string of characters (a hash value). In
blockchain, hash functions are crucial for:
·
Immutability: Each block includes the hash of the
previous block, creating an unbreakable chain. Any alteration to an old block's
data changes its hash, invalidating the subsequent block and making tampering
easily detectable.
·
Data Integrity: Hashes act as a "digital
fingerprint." If the hash of data matches a known hash, the data is
confirmed to be unaltered.
·
Mining (Proof of Work): Miners in PoW
blockchains compute hashes to find a specific output, securing the network and
adding new blocks.
·
Merkle Trees: Transactions within a block are
summarized into a single Merkle Root hash,
included in the block header, allowing efficient verification of transactions.
Good hash functions are deterministic, one-way (irreversible),
collision-resistant (hard to find two inputs with the same hash), and exhibit
an avalanche effect (small input change yields large hash change). Common
examples are SHA-256 (Bitcoin) and Keccak-256 (Ethereum).
2. Patterns of Hashing Data
Hashing patterns refer to how hash
functions are applied in systems:
·
Independent Hashing: Each data item is
hashed individually.
·
Repeated Hashing: A hash is re-hashed multiple times
(e.g., in Proof of Work).
·
Combined Hashing: Multiple data pieces are
concatenated and hashed together.
·
Sequential Hashing: An existing hash
is combined with new data and re-hashed to update a chain of integrity (like
block linking).
·
Hierarchical Hashing (Merkle Trees): Data is arranged
in a tree structure, with individual item hashes combined hierarchically to
form a single root hash, enabling efficient verification of large datasets.
3. Uses of Hash Values
Hash values are vital for:
·
Data Integrity Verification: Confirming data
hasn't been tampered with.
·
Password Storage: Storing hashes of passwords instead
of plaintext for security.
·
Digital Signatures: A core component
to ensure the integrity and authenticity of signed documents.
·
File Identification: Unique
"fingerprints" for files, useful in malware detection and
deduplication.
·
Blockchain Immutability and Proof of Work: Essential for the
security and operation of blockchain networks.
4. Cryptography: Activities and Types
Cryptography is the science of
secure communication in the presence of adversaries. Key activities include:
·
Encryption/Decryption: Converting
readable data (plaintext) to unreadable (ciphertext) and back to ensure
confidentiality using keys.
·
Hashing: Creating unique, fixed-size outputs
for integrity and authentication.
·
Key Management: Securely handling cryptographic
keys.
·
Authentication & Non-repudiation: Verifying
identities and proving message origin/receipt.
·
Digital Signing: Cryptographically proving
authenticity and integrity of digital content.
Types of Cryptography:
1.
Symmetric-key: Uses a single, shared secret key for
both encryption and decryption. Fast but has key distribution challenges (e.g.,
AES).
2.
Asymmetric-key (Public Key): Uses a pair of
keys – a public key for encryption (or signature verification) and a private
key for decryption (or signing). Solves key distribution but is slower (e.g.,
RSA, ECC).
3.
Hash Functions: One-way functions for integrity, not
secrecy (e.g., SHA-256).
5. Digital Signatures
A digital signature
verifies the authenticity and integrity of digital messages using asymmetric
cryptography. The sender:
1.
Hashes the document.
2.
Encrypts this hash with their private key
(creating the signature).
3.
Sends the document and signature.
The recipient:
1.
Hashes the received document.
2.
Decrypts the signature using the sender's public key to get
the original hash.
3.
Compares the two hashes. If they match, the document is confirmed
authentic and untampered, and the sender cannot deny signing it
(non-repudiation).
Case Study: Blockchain Techniques in the Medical Field
Blockchain offers solutions for data
silos, privacy, and supply chain issues in healthcare. Here's a differentiation
of four key initiatives:
1.
Ambrosus:
Focus: Supply chain
integrity and traceability for pharmaceuticals using blockchain
(AMB-NET) and IoT sensors. Records data like temperature and
location to prevent counterfeiting and ensure product quality from manufacturer
to patient.
2.
Connecting Care:
Focus: Improving interoperability and secure data sharing of Electronic Health
Records (EHRs). Uses a permissioned blockchain with smart contracts
to manage patient consent and data access permissions. Often stores
hashes/metadata on-chain, with sensitive data off-chain.
3.
FarmaTrust:
Focus: Combating pharmaceutical counterfeiting and ensuring drug traceability.
Uses a private/consortium blockchain to record the journey of every drug
package from origin to patient, providing an immutable audit trail and alerting
to unauthorized alterations.
4.
MedRec (MIT DCI Prototype):
Focus: Decentralized EHR management and medical research data, empowering
patients with data control. An Ethereum-based prototype using smart contracts
to manage access permissions for EHR metadata/hashes, facilitating secure,
privacy-preserving research.
Differentiation Summary:
Feature |
Ambrosus |
Connecting Care |
FarmaTrust |
MedRec |
Primary Focus |
Supply Chain Integrity (Pharma) |
EHR Interoperability & Sharing |
Anti-Counterfeiting (Drugs) |
Decentralized EHRs & Research |
Core Technique |
Blockchain + IoT Sensors |
Permissioned Blockchain, Smart Contracts |
Private/Consortium Blockchain |
Ethereum-based, Smart Contracts |
Main Problem Solved |
Counterfeit drugs, product quality |
Fragmented EHRs, data access |
Counterfeit drugs, supply chain fraud |
Patient data ownership, research access |
Data on Chain |
Sensor data, product IDs |
Metadata/Hashes of EHRs, consents |
Drug IDs, supply chain events |
Metadata/Hashes of EHRs, permissions |
Comments
Post a Comment