TTTT

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 59

Crypto Primitives for

Cryptocurrency
Module 4
Topics
• Hash Functions
– Puzzle friendly hash
– Collision resistant hash
– Hash Pointers
– Digital signatures
– PublicKey Crypto
• Verifiable random functions
– Zero knowledge systems
• Bitcoin Blockchain Crypto
– Eliptic curve crypto
– SHA256
Hash Functions
• Hash functions are a type of algorithm that are used in cryptocurrency
• Used to encrypt data and ensure the integrity of a blockchain
• Hash functions take an input, like a key, and convert it into a fixed-
length output, or hash value.
• The output is usually a string of letters and numbers.
• Hash functions are essential to cryptocurrency because they make it
difficult to reverse the process and figure out the original data from the
hash.
• This is because even a small change to the input data will result in a
significantly different hash value.
Hash usage in Cryptocurrencies
• Hash functions are used in cryptocurrency to:
• Secure data: Ensure that data in a blockchain's
blocks is not altered
• Authenticate transactions: Pass transaction
information anonymously
• Bitcoin uses the SHA-256 hashing function,
which produces a 256-bit output from any
input.
Hash usage in Cryptocurrencies
• Data Integrity: Hash functions ensure the integrity of data. In cryptocurrencies, every transaction and
block of transactions is hashed. If any data is altered, the hash value changes, making it easy to detect
tampering or corruption. This is vital for maintaining the accuracy and trustworthiness of the
blockchain.
• Proof of Work: Many cryptocurrencies, such as Bitcoin, use hash functions as part of the Proof of
Work (PoW) mechanism. Miners must solve a computationally difficult problem that involves finding a
hash that meets certain criteria (e.g., a hash with a certain number of leading zeros). This process
requires substantial computational power, which secures the network against attacks and prevents
double-spending.
• Block Creation and Chain Security: Each block in a blockchain contains the hash of the previous block.
This creates a chain of blocks where each block is linked to its predecessor. If someone tries to alter
the data in a previous block, it would change the hash of that block and disrupt the entire chain,
making it apparent that tampering has occurred. This chaining makes the blockchain highly secure and
resistant to modifications.
• Address Generation: Hash functions are used to generate cryptocurrency addresses. For example, in
Bitcoin, a user's public key is hashed to produce a shorter, more manageable address. This process
enhances privacy and security by obscuring the actual public key.
• Efficient Verification: Hash functions allow for quick verification of data. For instance, when a new
block is added to the blockchain, nodes can quickly verify the block's hash to ensure it meets the
network's consensus rules without having to inspect all transaction details manually.
Hash usage in Cryptocurrencies
• Typical hash functions take inputs of variable
lengths to return outputs of a fixed length.
• A cryptographic hash function combines the
message-passing capabilities of hash functions
with security properties.
• Hash functions are algorithms that determine
how information is encrypted.
• Not all cryptocurrencies use SHA 256.
Puzzle Friendly Hash
• A hash function is considered puzzle-friendly if it's
difficult to find an input that produces a specific
output.
• This property is used in Bitcoin mining, where the
miner must find a specific number that, when
combined with block data, produces a hash that
falls within a certain range.
• The first miner to solve the puzzle is rewarded
with Bitcoin and the ability to add the transaction
to the blockchain.
Properties of Cryptographic hash functions
• Collision-free: No two different inputs should map to the same
output.

• Hidden: It's difficult to guess the input value for a hash function
from its output.

• Deterministic: Hash functions are deterministic, meaning they


produce the same output for the same input.

• Efficiently computed: Hash functions are efficiently computed.


Cryptocurrency and Hash Fucntions
• SHA-256: Used by Bitcoin

• Keccak-256: Used by Ethereum

• MD5: Used for encoding sensitive information


How to find Collision resistant Hash
• A hash function is considered collision resistant if it's hard to find two
different inputs that hash to the same output.
• Length of output: A hash function with a result length of at least 160 bits
is a minimum requirement for collision resistance. To make a collision
search infeasible for 15–20 years, the result should be 180 bits or more.
• Collision probability: This is the likelihood of randomly finding a collision.
• Work factor: This is the computational effort required to find a collision by
brute force.
• Collision attack complexity: This is the fastest known computational
complexity to find a collision.
• Some hash functions that were once thought to be collision resistant have
since been broken. For example, there are published techniques that are
more efficient than brute force for finding collisions in MD5 and SHA-1.
Hiding property
• A cryptographic hash function is a mathematical
algorithm that has the property of hiding information.
• It's used to hide a message by using a generated key,
and then publishing the hash result as a commitment.
• The key and message are kept private, and can be
revealed later by publishing the key and message.
• A hash function H is hiding if: when a secret value r is
chosen from a probability distribution that has high
entropy, then given H(r ‖ x) it is infeasible to find x.
• ‖ means concatenation of two strings.
Hash Pointers
• hash pointer is a data structure that combines two key
elements:
• Pointer: A reference to another location in memory or
a specific data block.
• Hash: A cryptographic hash of the data at that location.
• In essence, a hash pointer points to a location in a data
structure and includes a hash of the data stored at that
location.
• This combination provides both the ability to quickly
locate data and verify its integrity.
Data structure – using Hash Pointers
Working of HASH Pointers
• Hash Calculation: When a hash pointer is created, it
first computes the hash of the data it points to.
• This hash value is a fixed-size string derived from the
data, designed to be unique for each unique piece of
data.
• Pointer and Hash Storage: The hash pointer stores both
the location or identifier of the data and the hash value.
• This allows anyone with the hash pointer to not only
locate the data but also verify that it hasn't been
altered.
Hash Pointer Applications - Blockchain
• Data Integrity: In blockchains, hash pointers are used to
link blocks.
• Each block contains a hash pointer to the previous block,
ensuring that any tampering with previous blocks will be
evident because it would change the hash values in the
chain.
• Consensus Mechanisms: Blockchain networks use hash
pointers as part of consensus algorithms like Proof of
Work (PoW) and Proof of Stake (PoS), where the
integrity of the entire chain is crucial for the security of
the network.
Transaction validation
• Transaction Creation
• Initiation: A user creates a transaction by specifying the sender, recipient, amount, and
other relevant details. The transaction is then signed with the sender’s private key.
• Broadcasting: The signed transaction is broadcasted to the network of nodes.
• Initial Validation by Nodes
• Signature Verification: Nodes verify the digital signature to ensure that the transaction
was indeed authorized by the sender. This involves checking the sender's public key
and ensuring the signature matches the transaction data.
• Double-Spending Check: Nodes verify that the sender has not already spent the same
assets elsewhere (i.e., no double-spending).
• Sufficient Balance: The node checks if the sender’s account has enough balance to
cover the transaction amount.
• Format and Syntax: The transaction data is checked for correct formatting and
adherence to network rules (e.g., valid addresses, correct amount).
• Transaction Pool
• Pending Transactions: Valid transactions are placed in a pool of pending transactions
(also known as the mempool). These transactions await inclusion in a new block.
Block Validation
• Block Proposal
• Block Creation: A miner or validator proposes a new block by selecting
transactions from the pool, creating a block header, and forming the new block.
• Block Header: Contains metadata such as the previous block’s hash, a
timestamp, and the Merkle root (a hash representing all the transactions in the
block).
• Block Broadcast
• Propagation: The proposed block is broadcasted to the network for validation.
• Validation by Nodes
• Header Verification: Nodes first verify the block header, including:
– Proof of Work (for PoW): Ensuring the block meets the required difficulty level.
• Agreement: Nodes use the consensus mechanism to agree on the validity of the
block.
• Chain Update: Once a block is validated and consensus is reached, it is added to
the blockchain. The new block is appended to the existing chain, and the
transactions in the block are considered confirmed.
Hash pointer applications
• Cryptographic Linked Lists:
• Hash-Linked Lists: In hash-linked lists, each node contains a
hash pointer to the next node.
• This structure is used in various data storage systems and
applications to ensure the integrity of data and prevent
unauthorized changes.
• Merkle Trees:
• Efficient Data Verification: Merkle trees, used in blockchain
and distributed systems, utilize hash pointers to create a tree
structure where each leaf node contains data, and each non-
leaf node contains a hash of its child nodes.
• This allows efficient and secure verification of large datasets.
Merkle Tree
Digital Signatures
• Digital signatures are fundamental to the security
and functionality of cryptocurrency systems.
• They authenticate transactions, verify the integrity
of data, ensure secure access to funds, and
support various aspects of blockchain technology,
including smart contracts and decentralized
governance.
• By leveraging cryptographic techniques, digital
signatures help maintain trust and security in
decentralized and distributed systems.
Digital Signature Applications
• Transaction Authentication
• Identity Verification: Digital signatures are used to verify the
identity of the sender in a cryptocurrency transaction. When a
user initiates a transaction, they sign it with their private key.
• This signature can be verified by others using the sender’s public
key, ensuring that the transaction was indeed authorized by the
holder of the corresponding private key.
• Preventing Double-Spending: By signing transactions, digital
signatures help prevent double-spending, which is the attempt
to spend the same cryptocurrency more than once.
• Each transaction must be signed and verified, making it difficult
for users to fraudulently reuse their coins.
Digital Signature Applications
• Integrity of Transactions
• Data Integrity: Digital signatures ensure that the data within a transaction
has not been altered after it was signed. If any part of the transaction data
changes, the signature will no longer be valid, alerting the network to
potential tampering or fraud.
• 3. Blockchain Security
• Block Signing: In Proof of Stake (PoS) and some other consensus
mechanisms, validators or miners sign blocks with their private keys. This
signing process helps to confirm the legitimacy of the blocks added to the
blockchain. It ensures that only authorized entities can propose new blocks
and that their proposals are valid.
• Block Verification: Each block in a blockchain can include digital signatures
from the creators or miners. These signatures are used to verify that the
block and its transactions are legitimate and have not been tampered with.
How Digital signature Works
• Digital signatures are a cryptographic technique used to
verify the authenticity and integrity of digital messages or
documents.
• They function similarly to handwritten signatures but offer a
higher level of security due to the use of encryption.
• Key Pair Generation
• Public Key and Private Key: Digital signatures rely on
asymmetric cryptography, which involves a pair of keys: a
private key and a public key.
• The private key is kept secret by the owner, while the public
key is shared openly.
How Digital signature Works
• Signing Process
• Hashing the Message:
– First, the message or document that needs to be signed is processed using a
cryptographic hash function.
– This function generates a fixed-size hash value (digest) that uniquely represents the
content of the message.
– Hash functions used are designed to produce a unique output for each unique input,
making it infeasible to derive the original message from the hash.
• Encrypting the Hash:
– The hash value is then encrypted using the sender's private key. This encrypted hash,
combined with the original message, forms the digital signature.
– The encryption of the hash ensures that only the sender, who possesses the private key,
could have created the signature.
• 3. Sending the Message
• The digital signature, along with the original message, is sent to the recipient. The
digital signature can be attached to the message or stored separately.
How Digital signature Works
• Verification Process
• Hashing the Received Message:
– Upon receiving the message and the digital signature, the recipient first hashes
the received message using the same cryptographic hash function used by the
sender. This generates a new hash value based on the received content.
• Decrypting the Signature:
– The recipient then decrypts the digital signature using the sender’s public key.
This decryption process reveals the original hash value that was encrypted by
the sender.
• Comparing Hashes:
– Finally, the recipient compares the hash value obtained from the received
message with the hash value obtained from decrypting the digital signature. If
both hash values match, it confirms that the message has not been altered and
that the signature is valid, thus authenticating the sender’s identity and ensuring
the integrity of the message.
Security Aspects
• Integrity: Digital signatures ensure that the message has
not been altered during transmission. Any change in the
message would result in a different hash value, making
the digital signature invalid.
• Authentication: By using the sender's public key to verify
the signature, recipients can confirm that the signature
was indeed created by the sender, who possesses the
corresponding private key.
• Non-Repudiation: Digital signatures provide proof of
origin, meaning the sender cannot deny having sent the
message. This is crucial for legal and financial transactions.
Digital Signature Providers
• BitGo
• BitGo is a leading provider of digital asset custody and security solutions. They
offer multi-signature wallet solutions and custodial services that use advanced
cryptographic techniques, including digital signatures, to secure cryptocurrency
holdings.
• Ledger
• Ledger is a well-known manufacturer of hardware wallets, which are physical
devices that securely store private keys and use digital signatures to authorize
transactions. Ledger's devices include the Ledger Nano S and Ledger Nano X.
• Chainalysis
• Chainalysis provides blockchain analytics and compliance solutions. They use
digital signatures and cryptographic techniques to track and analyze
cryptocurrency transactions for regulatory compliance and security.
• Elliptic
• Elliptic specializes in blockchain analytics and anti-money laundering (AML)
solutions. They use digital signatures and other cryptographic methods to help
businesses and regulators monitor and investigate cryptocurrency transactions.
Public Key Cryptography Basics
• Key Pair Generation:
• Public Key: A public key is a cryptographic key that can be
shared with anyone. It is used to receive funds and verify
signatures.
• Private Key: A private key is a confidential cryptographic key
known only to the owner. It is used to sign transactions and
prove ownership of assets.
• Encryption and Decryption:
• Encryption: Data encrypted with a public key can only be
decrypted with the corresponding private key.
• Digital Signatures: Data signed with a private key can be verified
with the corresponding public key.
Public Key Cryptography Basics
• Transaction Verification:
• Public Key Verification: Other network participants use the sender’s public key
to verify the transaction’s digital signature. This process confirms that the
transaction was signed by the holder of the corresponding private key and has
not been tampered with.
• Integrity and Non-repudiation: The verification process ensures that the
transaction is valid and that the sender cannot deny their involvement, as only
they could have created the valid signature.
• Security:
• Impossibility of Key Derivation: The public key is derived from the private key,
but it is computationally infeasible to derive the private key from the public key.
This ensures that the private key remains secure even if the public key is known.
• Signature Verification: The digital signature process ensures that transactions
cannot be altered without detection, as any change would invalidate the
signature.
Bitcoin Example
• Address Creation:
• A Bitcoin wallet generates a key pair: a public key and a private key.
• The public key is hashed to create a Bitcoin address, which can be shared to
receive Bitcoin.
• Sending Bitcoin:
• To send Bitcoin, the user creates a transaction and signs it with their private
key.
• The transaction, including the digital signature, is broadcast to the Bitcoin
network.
• Network Verification:
• Nodes in the network use the public key to verify the digital signature on
the transaction.
• If the signature is valid, the transaction is added to the blockchain, and the
Bitcoin is transferred.
Verifiable Random Functions
• A Verifiable Random Function (VRF) is a
cryptographic primitive that produces a
random output, which is both verifiable and
unpredictable.
• VRFs are useful in various applications,
including blockchain and cryptographic
protocols, where randomness and verification
are crucial.
Verifiable Random Functions
• Key Concepts
• Randomness: The output of a VRF is random and
cannot be predicted before computation.
• Verifiability: Anyone can verify that the output
was correctly generated by a specific input and
key.
• Unpredictability: Even knowing the output, it is
computationally infeasible to determine the input
or predict future outputs without the private key.
Verifiable Random Functions
• Components of a VRF
• Private Key (sk): Used to generate the random output
and proof.
• Public Key (pk): Used to verify the proof.
• Input (x): The input for which the random value is
generated.
• Output (r): The random value produced by the VRF.
• Proof (π): A cryptographic proof that the output is
correctly generated and can be verified using the
public key.
Verifiable Random Functions
• How a VRF Works
• Key Generation: A private-public key pair is generated. The
private key is used for computation, and the public key is used for
verification.
• Random Output Generation:
– Input: The user provides an input xxx.
– Computation: Using the private key sksksk and input xxx, the VRF
computes a random output rrr and a proof π.
• Verification:
– Proof Verification: Anyone with the public key pkpkpk, the input xxx,
the output rrr, and the proof π can verify that the output rrr is indeed
the result of the VRF computation for the input xxx and the
corresponding private key.
Verifiable Random Functions - Example
• Key Generation:
– Private Key: sksksk
– Public Key: pkpkpk
• Random Output Generation:
– Input: Suppose xxx is a random number or string, e.g., "block-123".
– Computation: The VRF uses sksksk and xxx to compute:
• Random Output rrr: A random number, e.g., 42.
• Proof π: A cryptographic proof demonstrating that rrr is a valid output for input xxx and private key
sksksk.
• Verification:
– Public Key: pkpkpk is available to anyone.
– Input: x="block−123"
– Output: r=42
– Proof: π
• To verify:
– Anyone can use pkpkpk, xxx, rrr, and π to check that rrr is indeed a valid random output for
xxx using pkpkpk.
Applications of VRFs
• Blockchain Protocols:
• Randomness in Consensus: VRFs can be used to generate random
values for leader selection or block generation in a verifiable manner.
For example, Algorand uses a VRF to select a leader for block creation.
• Randomness for Sharding: VRFs can help in determining which nodes
participate in a particular shard in a blockchain network.
• Cryptographic Security:
• Secure Random Number Generation: VRFs provide secure and
verifiable random numbers for cryptographic applications, ensuring that
the randomness is both unpredictable and verifiable.
• Commitment Schemes:
• Verifiable Commitments: VRFs can be used in commitment schemes
where the committed value is kept hidden but can be verified later.
Zero knowledge Systems
• Zero-Knowledge Systems (or Zero-Knowledge
Proofs) are cryptographic methods used to
prove the validity of information without
revealing the information itself.
• A Zero-Knowledge Proof is a cryptographic
technique that allows one party (the prover)
to demonstrate to another party (the verifier)
that a statement is true without disclosing any
details about the statement itself.
Key Properties of Zero-Knowledge Proofs

• Completeness: If the statement is true, an honest


verifier will be convinced of the validity of the
statement by an honest prover.
• Soundness: If the statement is false, a cheating
prover cannot convince an honest verifier that the
statement is true.
• Zero-Knowledge: The verifier learns nothing
beyond the fact that the statement is true. No
additional information about the statement is
revealed.
Types of Zero-Knowledge Proofs
• Interactive Zero-Knowledge Proofs: Involve
multiple rounds of communication between
the prover and verifier.
• Non-Interactive Zero-Knowledge Proofs: Do
not require interaction between prover and
verifier after the initial setup. These are often
based on cryptographic assumptions such as
hash functions.
Applications in Cryptocurrencies
• Privacy Enhancements:
• Transaction Privacy: Zero-Knowledge Proofs can be used to
conceal transaction details while still proving that transactions are
valid. This is useful for maintaining privacy in financial transactions.
• Scalability Improvements:
• Efficient Verification: Zero-Knowledge Proofs can be used to
compress and efficiently verify large amounts of data, reducing the
amount of data that needs to be transmitted and stored.
• Identity Verification:
• Anonymous Credentials: Zero-Knowledge Proofs can be used to
verify identity or other credentials without revealing sensitive
information, enhancing privacy in identity management systems.
Example of Zero-Knowledge Proof in
Cryptocurrencies
• Zcash and zk-SNARKs
• Zcash is a cryptocurrency that uses Zero-
Knowledge Proofs to enable private
transactions.
• It employs a specific type of Zero-Knowledge
Proof called zk-SNARKs (Zero-Knowledge
Succinct Non-Interactive Arguments of
Knowledge) to provide transaction privacy.
How zk-SNARKs Works

• Transaction Setup:
• Prover: The sender of the transaction creates a zk-SNARK proof. This proof
demonstrates that they possess the required private keys and that the transaction
adheres to the rules (e.g., no double-spending) without revealing the transaction
details.
• Verification: The proof is sent along with the encrypted transaction data to the
network. The zk-SNARK proof enables nodes to verify the correctness of the
transaction without seeing the details, such as sender, recipient, or amount.
• Proof Generation:
• The prover generates a zk-SNARK proof using the transaction information, including
encrypted amounts and addresses. This proof attests to the fact that the transaction is
valid under the blockchain’s rules without disclosing any details about the transaction.
• Proof Verification:
• Verifiers: Nodes in the Zcash network use the zk-SNARK proof to verify that the
transaction is valid. They can confirm that the proof corresponds to a legitimate
transaction without learning any specifics about the transaction.
Blockchain
• A blockchain is a computer file for storing data.
• It’s an open, distributed ledger (database), which means the data
contained within the blockchain is distributed (duplicated) across many
computers and is therefore decentralised.
• This decentralisation is one of the things that makes blockchain so
transformative.
• Unlike in a traditional, centralised database – where records are
processed by one central administrator (say, a company or government) –
the entire blockchain is transparent and data is verified by user consensus.
• Despite this transparency, blockchains are incredibly secure. That’s
because there’s no one central point of attack for hackers to target.
• Blockchain is the technology that underpins Bitcoin and it was developed
specifically for Bitcoin.
Bitcoin
• Bitcoin is a decentralised digital currency, or peer-to-
peer electronic payment system, where users can
anonymously transfer bitcoins without the interference
of a third-party authority (like a bank or government).
• Bitcoin is just one example of a cryptocurrency,
though; other cryptocurrency networks are also
powered by blockchain technology.
• So although Bitcoin uses blockchain technology to
trade digital currency, blockchain is more than just
Bitcoin.
Bitcoin Blockchain
• The Bitcoin blockchain collects transaction
information and enters it into a 4MB file called a
block (other blockchains use different size blocks).
• Once it is full, certain information is run through
an encryption algorithm, which creates a
hexadecimal number called the block header hash.
• Anyone can download a copy of the blockchain,
and it can be inspected to trace the path of
bitcoins from one bitcoin transaction to another.
Bitcoin blockchain
• Bitcoin is a cryptocurrency, while blockchain is a distributed
database.
• Bitcoin is powered by blockchain technology,
but blockchain has found many uses beyond Bitcoin.
• Bitcoin promotes anonymity, while blockchain is
about transparency.
• To be applied in certain sectors (particularly banking),
blockchain has to meet strict Know Your Customer rules.
• Bitcoin transfers currency between users, while blockchain
can be used to transfer all sorts of things, including
information or property ownership rights.
Eliptic Curve Cryptography
• ECC, as the name implies, is an asymmetric encryption algorithm that
employs the algebraic architecture of elliptic curves with finite fields.
• Elliptic Curve Cryptography (ECC) is an encryption technology comparable
to RSA that enables public-key encryption.
• While RSA’s security is dependent on huge prime numbers, ECC leverages
the mathematical theory of elliptic curves to achieve the same level of
security with considerably smaller keys.
• Victor Miller and Neal Koblitz separately proposed elliptic curve ciphers in
the mid-1980s. On a high level, they are analogs of actual public
cryptosystems in which modular arithmetic is substituted by elliptic curve
operations.
• The security of elliptic curve cryptosystems, like that of all public-key
cryptosystems, is based on tough mathematical issues at the core. Given
two elliptic curve points G and Y, where Y = kG.
Components of ECC
• ECC keys:
• Private key: ECC cryptography’s private key creation is as
simple as safely producing a random integer in a specific
range, making it highly quick. Any integer in the field
represents a valid ECC private key.
• Public keys: Public keys within ECC are EC points, which are
pairs of integer coordinates x, and y that lie on a curve.
• Because of its unique features, EC points can be compressed
to a single coordinate + 1 bit (odd or even). As a result, the
compressed public key corresponds to a 256-bit ECC.
Components of ECC
• Generator Point:
• ECC cryptosystems establish a special pre-defined EC point called
generator point G (base point) for elliptic curves over finite
fields, which can generate any other position in its subgroup
over the elliptic curve by multiplying G from some integer in the
range [0…r].
• The number r is referred to as the “ordering” of the cyclic
subgroup.
• Elliptic curve subgroups typically contain numerous generator
points, but cryptologists carefully select one of them to generate
the entire group (or subgroup), and is excellent for performance
optimizations in calculations. This is the “G” generator.
ECC Digital Signature Algorithms
• Digital signature algorithms:
• Elliptic Curve Digital Signature Algorithm. (ECDSA): ECDSA, or Elliptic Curve Digital
Signature Algorithm, is a more highly complicated public-key cryptography encryption
algorithm.
• Elliptic curve cryptography is a type of public key cryptography that uses the algebraic
structure of elliptic curves with finite fields as its foundation.
• Elliptic curve cryptography is primarily used to generate pseudo-random numbers,
digital signatures, and other data.
• Edwards-curve Digital Signature Algorithm (EdDSA): The Edwards-curve Digital
Signature Algorithm (EdDSA) was proposed as a replacement for the Elliptic Curve
Digital Signature Algorithm for performing fast public-key digital signatures (ECDSA).
• Its primary benefits for embedded devices are higher performance and simple, secure
implementations.
• During a signature, no branch or lookup operations based on the secret values are
performed.
• Many side-channel attacks are foiled by these properties.
ECC encryption algorithms
• Elliptic Curve Integrated Encryption Scheme (ECIES): ECIES is a public-key
authenticated encryption scheme that uses a KDF (key-derivation function) to
generate a separate Medium Access Control key and symmetric encryption
key from the ECDH shared secret.
• Because the ECIES algorithm incorporates a symmetric cipher, it can encrypt
any amount of data.
• In practice, ECIES is used by standards such as Intelligent Transportation
Systems.
• EC-based ElGamal Elliptic Curve Cryptography: ElGamal Elliptic Curve
Cryptography is the public key cryptography equivalent of ElGamal encryption
schemes that employ the Elliptic Curve Discrete Logarithm Problem.
• ElGamal is an asymmetric encryption algorithm that is used to send messages
securely over long distances.
• Unfortunately, if the encrypted message is short enough, the algorithm is
vulnerable to a Man in the Middle attack.
ECC key agreement algorithm
• Elliptic-curve Diffie–Hellman (ECDH): Elliptic-curve
Diffie-Hellman (ECDH) is a key agreement protocol
that enables two parties to establish a shared secret
over an insecure channel, each with an elliptic-
curve public-private key pair.
• This shared secret can be used directly as a key or
to generate another key.
• Following that, the key, or the derived key, can be
used to encrypt subsequent communications with a
symmetric-key cipher.
Application of ECC
• Elliptic Curve Digital Signature Algorithm (ECDSA): ECC is
one of the most widely utilized digital signature
implementation approaches in cryptocurrencies
• In order to sign transactions, both Bitcoin and Ethereum use
the field inverse multiplication, but also arithmetic
multiplication, inverse function, and modular operation.
• Blockchain application: The cryptocurrency Bitcoin
blockchain employs elliptic curve cryptography. Ethereum
2.0 makes heavy use of elliptic curve pairs with BLS
signatures, as stated in the IETF proposed BLS specification,
to cryptographically ensure that a specific Eth2 validator has
really verified a specific transaction.
ECC and RSA comparison
Parameters ECC RSA

Working ECC is a cryptography technique that works just on RSA cryptography algorithm is primarily based on
algorithm a mathematical model of elliptic curves. the prime factorization approach.

Bandwidth ECC gives significant bandwidth savings over RSA.


RSA provides much lesser bandwidth saving than
savings ECC.

Encryption The encryption process takes less time in ECC. The encryption process takes more time in RSA.
process
Decryption The decryption process takes more time. Decryption is faster than ECC.
process
ECC is much safer than RSA and is currently in the
Security process of adapting.
RSA is heading toward the end of its tenure.
SHA256
• SHA-256, or Secure Hash Algorithm 256-bit, is a
cryptographic hash function used in blockchain
technology for a variety of purposes
• Secure Hash Algorithm 256-bit, also known as SHA-256,
is a cryptographic hash function that converts text of
any length to an almost-unique alphanumeric string of
256 bits. The output is known as a hash value or hash.
• Creating digital signatures, Cryptocurrency mining,
Verifying data integrity, and Creating private and public
key pairs.
Application of SHA 256 in blockchain
• Cryptographic hashes
• Cryptographic hashes are unique and irreversible, and are deterministic, meaning
that identical data will always create the same hash.
• Collision minimization
• SHA-256 minimizes collisions, which is when different data produces the same
hash.
• Bitcoin encryption
• SHA-256 was first used in Bitcoin's encryption when the network launched in
2009.
• Other blockchain projects
• SHA-256 is used in many other blockchain projects, including Bitcoin Cash and
Bitcoin Satoshi's Vision.
• Digital currency security
• As of August 2024, the SHA-256 mining algorithm protects over $1.2 trillion in
digital currencies.
SHA256 Key properties
• Uniqueness
• When the SHA-256 hash function is used, distinct inputs will always produce unique
hash values. Even a small variation in the input will result in a vastly different hash
value.

• This is known as the ‘avalanche effect’. Furthermore, the hash value will always be
256 bits long, no matter the size of the input.

• Here is an example of SHA-256 implementation. The hash value of similar inputs


results in vastly differing hash values. While a single-character input produces the
same length of the hash value as an eight-character length input.

• InputHash value
• m
62c66a7a5dd70c3146618063c344e531e6d4b59e379808443ce962b3abd63c5a
• me 2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0
• meandyou
cf7af6b1be152c4f427a3b5beb444e85eeadfb9e062ed420fb9b9a10ccfbadf7
SHA256 Key properties
• irreversibility
• Hash values created using SHA-256 are computationally infeasible to reverse
engineer, meaning you cannot obtain the original input data from the hash
value.
• This ensures that the data remains protected even if the hash value is publicly
available, which makes sharing files publicly easy without worrying about a
bad actor decrypting them.
• Deterministic
• SHA-256 will always produce the same hash value for a particular input.
• This property ensures consistency in the hashing process allowing verification
of data across remote systems.
• Check the deterministic property of the SHA-256 hash function by verifying the
input and output of “m”, “me” and “meandyou” mentioned above on various
online hash generators like OnlineWebToolKit and Movable Type Scripts.
Usecase in Bitcoin Blockchain
• SHA-256 forms a critical component of major
blockchain protocols like Bitcoin and Bitcoin
SV. SHA-256 enables the proof-of-work (PoW)
consensus algorithm on the Bitcoin
blockchain.
• The cryptographic hash function is used to
verify transactions on the blockchain protocol.

You might also like