0% found this document useful (0 votes)
6 views10 pages

Cryptography and Distributed Databases Overview

Uploaded by

P B
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views10 pages

Cryptography and Distributed Databases Overview

Uploaded by

P B
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Syllabus

Module-1 8 Hours
Introduction to Fundamentals and Cryptography:

Basics: Distributed Database,

Two Generals’ Problem,

Byzantine Generals Problem and Fault Tolerance,

Cryptographic Hash Functions,

Hash Pointers and Data structures,

Digital Signatures,

Public keys as Identities,

Application Specific Integrated Circuits (ASIC) Memory Hard Functions

Module-2 8 Hours
Bitcoin Blockchain-1 History of Bitcoin,

Transactions,

Blocks,

Mining and the Blockchain,

Bitcoin Transactions, Constructing a Transaction, Bitcoin Mining, Mining Transaction in


Blocks, Spending the Transaction, Bitcoin Addresses, Wallets, Transactions: Transaction
Lifecycle, Transaction Structure, Transaction Outputs and Inputs, Transaction Chaining and
Orphan Transactions, Transaction Scripts and Script Language, Standard Transactions- Pay
to Public Key Hash (P2PKH) Pay to Script Hash (P2SH).
Part-1

Introduction to Fundamentals of Cryptography and Distributed Databases

Introduction to Fundamentals of Cryptography

Cryptography is the science of securing communication and data through techniques that
allow only the intended recipients to access the information. It is a foundational technology
for ensuring confidentiality, integrity, and authenticity in digital communication.

Why Cryptography Matters ?????

With the rise of digital communication and data storage, protecting sensitive information has
become crucial. Cryptography addresses:

1. Confidentiality: Ensuring data is accessible only to authorized parties.


2. Integrity: Ensuring data is not tampered with during transmission or storage.
3. Authentication: Verifying the identity of parties involved in communication.
4. Non-Repudiation: Preventing denial of actions, like sending a message or signing a
document.

Key Components of Cryptography

1. Plaintext:
o The original, readable message or data.
o Example: "Hello, World!"
2. Ciphertext:
o The encrypted form of plaintext, which is unreadable without a decryption
key.
o Example: "Uryyb, Jbeyq!" (Encrypted using ROT13).
3. Encryption:
o The process of converting plaintext into ciphertext using an algorithm and a
key.
4. Decryption:
o The reverse process of turning ciphertext back into plaintext using the
appropriate key.
5. Key:
o A secret value used in encryption and decryption. It determines the output of
the cryptographic algorithm.

Types of Cryptography

1. Symmetric Key Cryptography


 Description:
o Uses the same key for both encryption and decryption.
o Faster but requires secure key sharing between parties.

 Examples:
o AES (Advanced Encryption Standard), DES (Data Encryption Standard).
 Use Cases:
o Securing data storage, VPNs.

2. Asymmetric Key Cryptography

 Description:
o Uses a pair of keys: a public key (for encryption) and a private key (for
decryption).
o Solves the problem of key distribution in symmetric systems.
 Examples:
o RSA (Rivest–Shamir–Adleman), ECC (Elliptic Curve Cryptography).
 Use Cases:
o Secure email, digital signatures, SSL/TLS protocols.

3. Hashing

 Description:
o Converts data into a fixed-size hash value (digest), which cannot be reversed
to retrieve the original data.
o Used for data integrity verification.
 Examples:
o SHA-256, MD5.
 Use Cases:
o Storing passwords, verifying file integrity.

Cryptographic Algorithms

1. Substitution Cipher:

 Replaces each character in the plaintext with another character.


 Example: Caesar Cipher (shifts letters by a fixed number).

2. Block Cipher:

 Processes fixed-size blocks of data.


 Example: AES encrypts data in 128-bit blocks.

3. Stream Cipher:
 Encrypts data one bit or byte at a time.
 Example: RC4.

4. Public Key Cryptography (RSA):

 Based on the mathematical difficulty of factoring large numbers.


 Example: Encrypting a message with a recipient's public key ensures only they can
decrypt it with their private key.

Applications of Cryptography

1. Secure Communication:
o Encrypting emails, messages, and web traffic.
o Example: WhatsApp uses end-to-end encryption.
2. Data Protection:
o Encrypting sensitive files and databases.
o Example: Encrypting customer credit card information.
3. Authentication:
o Verifying users using passwords or digital certificates.
o Example: Logging into websites securely.
4. Blockchain and Cryptocurrencies:
o Ensuring secure transactions and data integrity.
o Example: Bitcoin uses SHA-256 for mining and transaction verification.
5. Digital Signatures:
o Ensuring document authenticity and integrity.
o Example: Signing contracts digitally.

Challenges in Cryptography

1. Key Management:
o Safeguarding and distributing keys securely.
2. Quantum Computing:
o Quantum computers may break current cryptographic algorithms like RSA.
3. Implementation Errors:
o Flaws in implementing algorithms can lead to vulnerabilities.
4. Performance:
o Encryption and decryption can add computational overhead.

Conclusion
Cryptography is an essential pillar of cybersecurity, providing the foundation for secure
communication, data protection, and trust in digital systems. As technology evolves, so does
the need for robust cryptographic methods to address emerging threats.

Part-2
Basics of Distributed Database

A distributed database is a system where data is stored across multiple physical locations,
which may be on the same network or across a wide-area network (WAN). The database
appears to users as a single database but is, in fact, distributed and managed by a distributed
database management system (DDBMS).

Key Characteristics of Distributed Databases

1. Decentralization:
o Data is stored on multiple nodes, and no single point of failure exists.
o Example: A banking system where data is replicated across global branches.
2. Transparency:
o Users experience a seamless database interaction without needing to know
where data is stored.
o Types of transparency:
 Location Transparency: Users don’t need to know where data is
stored.
 Replication Transparency: Users are unaware of data replication.
 Fragmentation Transparency: Users don’t need to know how data is
divided.
3. Scalability:
o The system can scale horizontally by adding more nodes or servers.
o Example: Social media platforms like Facebook.
4. Fault Tolerance:
o The database continues to function even if some nodes fail.
o Achieved through replication and redundancy.
5. Consistency:
o Ensuring data remains consistent across all nodes despite simultaneous
updates.
o Managed using distributed protocols like Two-Phase Commit (2PC) or
Consensus Algorithms (e.g., Raft, Paxos).
Cryptography in Distributed Databases

Cryptography ensures secure data sharing, storage, and communication in a distributed


database system. Key applications include:

1. Data Encryption:
o Ensures that data remains secure during storage and transmission.
o Techniques: AES (Advanced Encryption Standard), RSA (Rivest-Shamir-
Adleman).
2. Digital Signatures:
o Verifies the authenticity of data and its origin.
o Example: A node signing a transaction in a blockchain.
3. Hash Functions:
o Used to create a fixed-size hash value from data, ensuring integrity.
o Example: SHA-256 used in Bitcoin.
4. Access Control:
o Ensures only authorized users can access specific data.
o Managed using cryptographic keys.

Types of Distributed Databases

1. Homogeneous Distributed Databases:


o All nodes use the same database software.
o Example: Oracle RAC.
2. Heterogeneous Distributed Databases:
o Different nodes may use different database software.
o Example: Integrating MySQL and MongoDB.
3. Decentralized Databases:
o No central authority; every node has equal importance.
o Example: Blockchain (Bitcoin, Ethereum).

Distributed Database Architecture

1. Client-Server Architecture:
o Data is stored on a central server, and clients interact with it.
o Example: Traditional web applications.
2. Peer-to-Peer (P2P) Architecture:
o All nodes are equal, and data is distributed evenly.
o Example: File-sharing systems like BitTorrent.
3. Hybrid Architecture:
o Combines centralized and decentralized features.
o Example: Cloud-based distributed databases like Amazon Aurora.
Distributed Database Applications

1. Banking Systems:
o Enables global access to account information and transactions.
2. E-commerce Platforms:
o Ensures product catalogs and customer data are available worldwide.
3. Blockchain Systems:
o Implements decentralized distributed databases for cryptocurrencies and
DApps.
4. Content Delivery Networks (CDNs):
o Distributes content (e.g., videos, images) across global nodes to improve load
times.

Example: Using Blockchain as a Distributed Database

Blockchain is a decentralized, immutable distributed database where each block contains:

 A cryptographic hash of the previous block.


 A timestamp.
 Transaction data.

Example Scenario:

 A company wants to track the origin of products in its supply chain.


 Each step in the supply chain is recorded on a blockchain, ensuring transparency and
data integrity.

Challenges in Distributed Databases

1. Consistency vs. Availability:


o The CAP theorem states that distributed databases must trade-off between
Consistency, Availability, and Partition Tolerance.
2. Latency:
o Delays caused by data replication across multiple nodes.
3. Security:
o Protecting against unauthorized access and data breaches.
4. Complexity:
o Managing data synchronization, replication, and fault tolerance.

Conclusion
Distributed databases, when integrated with cryptographic principles, provide a secure,
scalable, and reliable solution for modern applications. From banking to blockchain, they are
the backbone of systems that require data availability and integrity across multiple locations.

Part-3
Syllabus Module-1 8 Hours Introduction to Fundamentals and Cryptography: Basics: Distributed
Database, Two Generals’ Problem, Byzantine Generals Problem and Fault Tolerance, Cryptographic
Hash Functions, Hash Pointers and Data structures, Digital Signatures, Public keys as Identities,
Application Specific Integrated Circuits (ASIC) Memory Hard Functions Module-2 8 Hours Bitcoin
Blockchain-1 History of Bitcoin, Transactions, Blocks, Mining and the Blockchain, Bitcoin Transactions,
Constructing a Transaction, Bitcoin Mining, Mining Transaction in Blocks, Spending the Transaction,
Bitcoin Addresses, Wallets, Transactions: Transaction Lifecycle, Transaction Structure, Transaction
Outputs and Inputs, Transaction Chaining and Orphan Transactions, Transaction Scripts and Script
Language, Standard Transactions- Pay to Public Key Hash (P2PKH) Pay to Script Hash (P2SH).

Two Generals' Problem: Explanation and Example

The Two Generals' Problem is a thought experiment in distributed computing that illustrates
the difficulty of achieving coordination and agreement between two parties (or nodes) in the
presence of unreliable communication. It highlights the challenges of consensus in distributed
systems.

The Problem

1. Imagine two generals, General A and General B, leading armies stationed on two
hills, planning to attack an enemy camp in a valley.
2. To succeed, both armies must attack simultaneously. If only one attacks, it will be
defeated.
3. They can only communicate via messengers, but the messengers might be intercepted
or fail to deliver messages.

Steps to Communicate:

1. General A sends a messenger to General B with a message: “Let’s attack at dawn.”


2. General B receives the message and sends back a confirmation: “Agreed, let’s attack
at dawn.”
3. General A, unsure if the confirmation reached General B, sends another confirmation:
“Did you receive my confirmation?”
This back-and-forth communication continues indefinitely because neither general can be
100% certain the other has the same understanding.

Key Insight

The Two Generals' Problem demonstrates that it is impossible to guarantee coordination in


a distributed system with unreliable communication. There will always be uncertainty
about whether the last message was successfully received.

Real-Life Analogy

Imagine two friends trying to meet at a café but can only communicate through a chain of
mutual acquaintances (unreliable messengers). Each tries to confirm the meeting time, but
because a reply might not reach, they are never sure if the other is coming.

Applications in Distributed Systems

The Two Generals' Problem reflects challenges in achieving consensus:

1. Network Communication:
o In distributed systems, messages can get lost, delayed, or corrupted, making
coordination difficult.
2. Blockchain Consensus:
o Protocols like Proof of Work and Proof of Stake address similar challenges
in achieving agreement across nodes.

Resolution in Practice

Although the Two Generals' Problem is unsolvable in theory, practical systems use
probabilistic or approximate solutions:

1. Timeouts:
o If no response is received within a certain time, the system assumes a failure
and retries.
2. Quorum-Based Voting:
o Decisions are made based on a majority agreement rather than requiring 100%
certainty.
3. Consensus Algorithms:
o Algorithms like Paxos, Raft, and Byzantine Fault Tolerance (BFT) tackle
similar issues in real-world distributed systems.
Example

Scenario: Database Update in a Distributed System

1. Node A: Proposes an update to a distributed database and sends the proposal to Node
B.
2. Node B: Acknowledges the update and sends back confirmation.
3. Node A: Sends another confirmation to ensure Node B received its acknowledgment.

Since there’s always a possibility of a message being lost, neither node can be 100% certain
that both have agreed on the update.

Solution:

Implement a consensus protocol like Raft or Paxos, which ensures eventual consistency
even if some messages are lost.

Conclusion

The Two Generals' Problem highlights the inherent limitations of achieving perfect
coordination in distributed systems with unreliable communication. While theoretically
unsolvable, practical workarounds like timeouts, retries, and consensus protocols enable
robust distributed computing.

You might also like