0% found this document useful (0 votes)
47 views15 pages

Unit 2 - Cryptographic Fundamentals

The document provides an overview of cryptographic fundamentals essential for cryptocurrencies, focusing on hashing and its properties. It explains how hashing secures transactions, supports blockchain structure, and facilitates Proof of Work mining. Additionally, it covers encryption schemes, highlighting symmetric and asymmetric encryption, with examples of algorithms used in blockchain technology.

Uploaded by

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

Unit 2 - Cryptographic Fundamentals

The document provides an overview of cryptographic fundamentals essential for cryptocurrencies, focusing on hashing and its properties. It explains how hashing secures transactions, supports blockchain structure, and facilitates Proof of Work mining. Additionally, it covers encryption schemes, highlighting symmetric and asymmetric encryption, with examples of algorithms used in blockchain technology.

Uploaded by

Fikirini Akbar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Cryptographic

Fundamentals
• Cryptographic Basics for Cryptocurrency: A
Short Overview of Hashing
• Cryptocurrencies rely heavily on cryptographic principles to ensure security,
immutability, and trust in a decentralized network.

• One of the fundamental cryptographic techniques used in cryptocurrency


systems is hashing.

• Hashing plays a crucial role in securing transactions, ensuring data integrity, and
enabling consensus mechanisms such as Proof of Work (PoW).
• Cryptographic Basics for Cryptocurrency: A
Short Overview of Hashing
1. What is Hashing?

• Hashing is the process of converting an input (data of any size) into a


fixed-length string, known as a hash value or digest, using a mathematical
function.

• A cryptographic hash function takes an input and produces a deterministic,


unique, and fixed-size output.

• For example, using the SHA-256 hashing algorithm:


• Cryptographic Basics for Cryptocurrency: A
Short Overview of Hashing
2. Properties of Cryptographic Hash Functions

• A secure cryptographic hash function must satisfy the following properties:


a. Deterministic: For a given input, the hash function always produces the same
output.
b. Fixed-Length Output: Regardless of input size, the output is always of fixed
length. For example, SHA-256 always produces a 256-bit (64-character) hash.
c. Pre-Image Resistance: It should be infeasible to determine the original input
from its hash.
d. Collision Resistance: No two different inputs should produce the same hash
(i.e., finding two inputs with the same hash should be extremely difficult).
• Cryptographic Basics for Cryptocurrency: A
Short Overview of Hashing
2. Properties of Cryptographic Hash Functions
e. Avalanche Effect: A small change in input should produce a drastically different
hash.
• Cryptographic Basics for Cryptocurrency: A
Short Overview of Hashing
3. Common Hash Functions Used in Cryptocurrencies

• Several cryptographic hash functions are used in different blockchain


implementations:

• SHA-256 (Secure Hash Algorithm-256): Used in Bitcoin, it generates a 256-bit


hash.

• Keccak-256: A variant of SHA-3, used in Ethereum.


• RIPEMD-160: Used in Bitcoin address generation.
• Scrypt & Argon2: Used in some cryptocurrencies (like Litecoin) for PoW mining
due to their memory-hard properties.
• Cryptographic Basics for Cryptocurrency: A
Short Overview of Hashing
4. Role of Hashing in Cryptocurrencies

a. Securing Transactions: Every transaction in a blockchain is hashed to generate


a unique transaction ID, ensuring that data remains tamper-proof.

b. Blockchain Structure (Merkle Trees): Transactions are grouped into blocks and
stored using Merkle Trees, where each leaf node is a hash of a transaction, and the
root hash represents the entire block’s transactions. This allows efficient
verification without downloading all transactions.
• Cryptographic Basics for Cryptocurrency: A
Short Overview of Hashing
4. Role of Hashing in Cryptocurrencies

c. Proof of Work (PoW) Mining: Bitcoin and many other cryptocurrencies use
PoW, where miners must find a nonce that produces a hash meeting a certain
condition (e.g., starting with a specific number of leading zeros). This process
secures the network and prevents fraudulent transactions.

d. Digital Signatures & Address Generation: Public-key cryptography relies on


hashing. Bitcoin addresses are derived using SHA-256 and RIPEMD-160 to improve
security.
• Cryptographic Basics for Cryptocurrency: A
Short Overview of Hashing
SHA-256: Cryptographic Hash Algorithm
• SHA-256 (Secure Hash Algorithm 256-bit) is a cryptographic hash function from the
SHA-2 family, designed by the NSA (National Security Agency) and standardized by
NIST (National Institute of Standards and Technology). It is widely used in
blockchain technology, digital signatures, and data integrity verification.

How SHA-256 Works


• SHA-256 takes an input message of any size and produces a fixed 256-bit (32-byte)
hash. It is:
✅ Deterministic – Same input always gives the same hash.
✅ Irreversible – Impossible to get the original input from the hash.
✅ Collision-resistant – No two inputs should produce the same hash.
✅ Fast and efficient – Used in Bitcoin mining and blockchain security.
• Cryptographic Basics for Cryptocurrency: A
Short Overview of Hashing
• SHA-256 in Blockchain (Bitcoin)
• Mining: Bitcoin miners must find a nonce (random number) such that:

• Address Generation: Bitcoin wallet addresses are derived using SHA-256 +


RIPEMD-160.

• Proof of Work (PoW): SHA-256 ensures data integrity and security.


• Cryptographic Basics for Cryptocurrency: A
Short Overview of Hashing
• Encryption Schemes in Blockchain
• Encryption is used in blockchain to ensure the confidentiality, integrity, and security of
data. It helps prevent unauthorized access and guarantees that only authorized parties
can read or modify sensitive data. There are two main types of encryption in the
context of blockchain: symmetric encryption and asymmetric encryption.

1. Symmetric Encryption

• Description: In symmetric encryption, the same key is used for both encryption and
decryption. Both the sender and the recipient must have the secret key to encrypt and
decrypt the message.

• Usage in Blockchain: Symmetric encryption is rarely used directly in public blockchain


transactions but may be used in private blockchains or for encrypting certain types of
data before storing them on the blockchain.
• Encryption Schemes in Blockchain

1. Symmetric Encryption
• Example Algorithms:AES (Advanced
Encryption Standard): Commonly used
symmetric encryption scheme for securing
sensitive data.

• Required Library: pip install pycryptodome


• Encryption Schemes in Blockchain
2. Asymmetric Encryption
• Description: Asymmetric encryption, also known as public-key cryptography, uses a
pair of keys: a public key and a private key. The public key encrypts the data, and only
the corresponding private key can decrypt it (and vice versa).
• Usage in Blockchain: Asymmetric encryption is fundamental in blockchain for:
✔ Securing transactions: A private key signs a transaction, and the corresponding public key verifies it.

✔ Identity verification: Public and private keys authenticate users in the system.

• Example Algorithms:
✔ RSA: An older asymmetric encryption algorithm used for securing communications and digital
signatures.
✔ Elliptic Curve Cryptography (ECC): A modern and more efficient asymmetric encryption algorithm
used in blockchain networks.
• Encryption Schemes in Blockchain

Elliptic Curve Cryptography (ECC): A modern and more efficient asymmetric encryption
algorithm used in blockchain networks.

✔ SigningKey.generate
creates a new private key
using the NIST384p elliptic
curve.

✔ sign() signs a message with


the private key.

✔ verify() verifies the signature


using the corresponding
public key.

You might also like