M o d u l e - 2
C h a p t e r - 3
Aparna N,[Link].,Dept. of CSE,CiTech.
Cryptographic primitives: Symmetric
cryptography,Asymmetric cryptography
Public and private keys
Hash functions: Compression of arbitrary
messages into fixed length digest
C O N T E N T S
Message Digest (MD)
Secure Hash Algorithms (SHAs)
Merkle trees, Patricia trees, Distributed hash
tables (DHTs),Digital signatures,Elliptic Curve
Digital signature algorithm (ECDSA).
Add Your Website Enter title
Cryptographic primitives:
S y m m e t r i c
cryptography,Asymmetric
c r y p t o g r a p h y
CRYPTOGRAPHIC PRIMITIVES
Cryptographic primitives are the basic building blocks of a
security protocol or system. A security protocol is a set of
steps taken in order to achieve required security goals by
utilizing appropriate security mechanisms. Various types of
security protocols are in use, such as authentication
protocols, nonrepudiation protocols, and key management
protocols.
CRYPTOGRAPHIC PRIMITIVES
A generic cryptography model is shown in the following
diagram:
CRYPTOGRAPHIC PRIMITIVES
In the diagram, P, E, C, and D represents Plain text, Encryption,
Cipher text, and Decryption, respectively.
Entity: It is either a person or a system that sends, receives, or
performs operations on data
Sender: Sender is an entity that transmits the data
Receiver: Receiver is an entity that takes delivery of the data
Adversary: This is an entity that tries to circumvent the security
service
Key: A key is some data that is used to encrypt or decrypt data
Channel: Channel provides a medium of communication between
entities
SYMMETRIC CRYPTOGRAPHY
• Symmetric cryptography, or secret key cryptography,
uses the same key for encryption and decryption,
requiring prior key agreement between parties.
Two types
Block ciphers (e.g.,
DES(Data Encryption stream ciphers (e.g., RC4, A5)
standard),
AES(Advanced
Encryption Standard))
Stream Ciphers
• Stream ciphers encrypt plaintext bit-by-bit using a key
stream. They are classified into:
Asynchronous (self-
Synchronous stream
synchronizing) stream ciphers:
ciphers: Key stream
Key stream depends on both the
depends only on the key
key and encrypted data.
Stream Ciphers
• Encryption & Decryption
• Use the same function (XOR
operation or modulo 2
addition).
• Key Requirement:
• Security and randomness of
key streams are crucial for
strong encryption.
Block ciphers
• Definition: Encrypt plaintext by
dividing it into fixed-length
blocks and processing each
block separately.
• Design Strategies:
• Feistel Cipher:
• Based on Feistel network,
developed by Horst Feistel.
• Uses multiple rounds to
achieve confusion and diffusion.
Block ciphers
• Substitution-Permutation Network (SPN):
• Used in modern ciphers like AES (Rijndael).
• Combines substitution and permutation for security.
• Feistel Cipher:
• Uses multiple rounds of repeated operations.
• Divides data into left and right blocks and processes
them using keyed round functions.
Block ciphers
• Key Cryptographic Properties:
• Confusion:
• Complex relationship between plaintext and ciphertext.
• Achieved through substitution (e.g., replacing 'A' with 'X').
• Modern ciphers use S-boxes (lookup tables) for substitution.
• Diffusion:
• Spreads plaintext statistically across ciphertext.
• A single bit change in plaintext affects half of the ciphertext bits
(on average).
• Achieved through transposition/permutation to make key
discovery difficult.
Block ciphers
• Advantages of Feistel Cipher:
• Encryption and decryption are almost identical.
• Decryption is just the reversal of the encryption process.
• Example: DES (Data Encryption Standard).
• Block Cipher Modes of Operation:
• Electronic Code Book (ECB),Cipher Block Chaining (CBC)
• Output Feedback Mode (OFB),Counter Mode (CTR)
• Define how encryption is applied to plaintext blocks.
Block ciphers Encryption Mode
• Block Encryption Mode:
• Plaintext is divided into fixed-length blocks.
• Encryption function is applied block by block.
• Keystream Generation Modes:
• Encryption function generates a keystream.
• Keystream is XORed with plaintext to produce ciphertext.
• Message Authentication Modes(MAC)
• Computes a Message Authentication Code (MAC) using an
encryption function.
• Provides integrity by ensuring data has not been altered.
• CBC-MAC (Cipher Block Chaining MAC):Uses part of the last
block in the encryption chain as the MAC.
Block ciphers Encryption Mode
• Cryptographic hashes
• Hash functions are basically used to compress a message to a
fixed length digest.
• In this mode, block ciphers are used as a compression function to
produce a hash of plain text.
ECB( Electronic Code Book)
• This is a basic mode of
operation in which the
encrypted data is produced as
a result of applying the
encryption algorithm one by
one separately to each block
of plain text.
• This is the simplest mode but
should not be used in practice
as it is insecure and can
reveal information.
Cipher block chaining(CBC)
• In this mode, each block of
plain text is XORed with the
previous encrypted block.
• The CBCmode uses
initialization vector IV to
encrypt the first block.
• It is recommended that IV be
randomly chosen.
Counter mode
• The CTR mode effectively
uses a block cipher as a
stream cipher.
• In this case, a unique
nonce is supplied that is
concatenated with the
counter value in order to
produce a key stream.
DATA ENCRYPTION STANDARD (DES)
• Introduced by NIST as a standard encryption algorithm.
• Widely used in the 1980s and 1990s.
• Uses a 56-bit key, making it vulnerable to brute force attacks.
• July 1998: EFF broke DES using a specialized machine.
• Advances in cryptography made brute force attacks feasible.
• Triple DES (3DES) Solution:
• Uses three 56-bit keys, creating a 168-bit key.
• Enhances security but has slow performance and a limited 64-bit
block size.
ADVANCED ENCRYPTION STANDARD (AES)
• In 2001, Rijndael, developed by Joan Daemen & Vincent Rijmen,
was selected as the Advanced Encryption Standard (AES) by
NIST.
• AES is highly secure, with no known attack better than brute
force.
• Original Rijndael supported 128-bit, 192-bit, and 256-bit block &
key sizes.
• AES Standard (NIST):
• Fixed block size: 128-bit
• Allowed key sizes: 128-bit, 192-bit, and 256-bit
AES STEPS
• AES processes data using a 4×4 byte array called the State.
• Encryption occurs in multiple rounds, modifying the State at each
step.
• The number of rounds depends on the key size:
AES Encryption Process
• Once the State is initialized with the input, AES performs four key
operations in each round:
• 1. AddRoundKey
• The State is XORed with a subkey derived from the master key.
• 2. SubBytes
• Each byte is substituted using a lookup table (S-box) for non-
linearity.
AES Encryption Process
AES Encryption Process
• 3. ShiftRows
• Rows (except the first) are shifted left cyclically, with increasing
offsets.
• 4. MixColumns
• Bytes are mixed column-wise using linear transformation for
diffusion.
• �Final Round Exception:
• MixColumns is skipped, and an additional AddRoundKey is
applied.
• Ensures that the first three steps cannot be easily reversed.
ASYMMETRIC CRYPTOGRAPHY/PUBLIC KEY CRYPTOGRAPHY
• Definition:
• A cryptographic technique where the encryption key differs from
the decryption key.
• Key Characteristics:
• Uses a public key for encryption and a private key for decryption.
• Common Algorithms:
• RSA (Rivest-Shamir-Adleman)
• DSA (Digital Signature Algorithm)
• ElGamal
ASYMMETRIC CRYPTOGRAPHY
ASYMMETRIC CRYPTOGRAPHY
• The diagram explains how a sender encrypts the data
using a recipient's public key and is then transmitted over
the network to the receiver.
• Once it reaches the receiver, it can be decrypted using
the receiver's private key.
• This way, the private key remains on the receiver's side
and there is no need to share keys in order to perform
encryption and decryption, which is the case with
symmetric encryption.
ASYMMETRIC CRYPTOGRAPHY
ASYMMETRIC CRYPTOGRAPHY
• This diagram shows how public key cryptography can be
used to verify the integrity of the received message by the
receiver.
• In this model, the sender signs the data using their private
key and transmits the message across to the receiver.
• Once the message is received on the receiver's side, it can
be verified for its integrity by the sender's public key.
• There is no encryption being performed in this model.
• This model is only used for message authentication and
validation purposes:
SECURITY MECHANISMS IN PUBLIC KEY CRYPTOSYSTEMS
• Key Establishment:
• Involves protocols for securely setting up cryptographic keys over an
insecure network.
• Digital Signatures:
• Provides authentication and non-repudiation, ensuring that a sender
cannot deny sending a message.
• Identification:
• Authenticates users and verifies their identity using digital signatures
and challenge-response protocols.
• Encryption & Decryption:
• Ensures data confidentiality using public key cryptosystems like RSA,
ECC, and ElGamal.
PERFORMANCE OF PUBLIC KEY ALGORITHMS
Slower Computation:
• Public key algorithms are computationally slower than symmetric
key algorithms.
Limited Use in Large-Scale Encryption:
• Not efficient for encrypting large files or bulk data.
Primary Use:
• Mainly used for key exchange to establish secure communication.
• Once keys are exchanged, symmetric key algorithms handle
actual data encryption.
THREE MAIN FAMILIES OF ASYMMETRIC ALGORITHMS
Integer factorization
• These schemes are based on the fact that large integers are very
hard to factor. Eg: RSA
Discrete logarithm
• A one-way function in modular arithmetic where computing the
modulo is easy, but finding the exponent is difficult.
• Example: Given:
• Finding 2 (exponent) from 9 is computationally hard.
• Importance: Used in Diffie-Hellman key exchange and digital
signature algorithms for secure cryptographic operations.
THREE MAIN FAMILIES OF ASYMMETRIC ALGORITHMS
Elliptic Curve Cryptography (ECC)
• Based on the Discrete Logarithm Problem:
• Uses elliptic curves for secure cryptographic operations.
• Elliptic Curve Equation: Defined as
• a,b are integers within a finite field.
• The curve is non-singular (no cusps or self-intersections).
• Field of Definition:
• Can be over real numbers, rational numbers, complex numbers, or finite
fields.
• For cryptography, elliptic curves over prime finite fields (p > 3) are used.
• Applications in Cryptography:
• ECDSA (Elliptic Curve Digital Signature Algorithm)
Add Your Website Enter title
Public and private
k e y s
PUBLIC AND PRIVATE KEYS
Private Key
• A randomly generated secret number
• Must be kept private and secure
• Used for decrypting messages in public-key cryptography
• Unauthorized access can compromise security
• Key length depends on the algorithm
• RSA: Typically 1024-bit or 2048-bit
• 1024-bit keys are no longer secure
• 2048-bit or higher is recommended
PUBLIC AND PRIVATE KEYS
Public Key
• Public part of the key pair • Must be kept private and secure
• Available to anyone • Used for decrypting messages in
• Published by the private key owner public-key cryptography
• Used to encrypt messages • Unauthorized access can
compromise security
• Sender encrypts a message using the
• Key length depends on the
recipient’s public key
algorithm
• Only the private key holder can decrypt
• RSA: Typically 1024-bit or 2048-
the message bit
• Authenticity of the public key • 1024-bit keys are no longer
• Identification of the key publisher secure
• Risk of man-in-the-middle attacks if • 2048-bit or higher is
public keys are not verified recommended
RSA
• Invented in 1977 by Ron Rivest, Adi Shamir, and Leonard Adleman
• Named after the initials of the inventors (R, S, A)
• Based on the integer factorization problem
Integer Factorization Problem
• Multiplying two large prime numbers is easy
• Factoring the result back into its original primes is computationally
hard
• Security of RSA relies on this difficulty
RSA Key Generation
• The most critical step in the RSA algorithm
• Involves multiple mathematical operations
• Generates a public and private key pair
RSA
Modulus generation:
• Select p and q very large primes
• Multiply p and q , n=p.q to generate modulus n
Generate co-prime:
• Assume a number called e.
• It should satisfy certain conditions, that is, it should be greater than 1
and less than (p-1) (q-1).
• e must be such a number that no number other than 1 can be divided
into e and (p-1) (q-1). This is called co-prime, that is, e is the co-prime
of (p-1)(q-1).
RSA
Generate public key:
• Modulus generated in step 1 and e generated in step 2 is pair that,
together, is a public key.
• This part is the public part that can be shared with anyone; p and q
need to be kept secret.
Generate private key:
• Private key called d here and is calculated from p, q and e. Private
key is basically the inverse of e modulo (p-1)(q-1).
• In the equation form, it is this:
ed = 1 mod(p-1)(q-1)
RSA
Calculating the Private Key (d)
• Extended Euclidean Algorithm is used to compute d
• Requires p, q, and e as inputs
• Key idea:
• If p and q are known → d can be easily calculated
• If p and q are unknown → d is impossible to derive
Importance of Large Primes
• p and q must be large to ensure security
• Ensures modulus n is difficult to factor
• Makes computing d computationally infeasible without p and q
ENCRYPTION AND DECRYPTION USING RSA
RSA uses the following equation to produce cipher text:
• C = Pe mod n
• This means that plain text P is raised to e number of times and then
reduced to modulo n.
Decryption in RSA
• P = Cd mod n
• This means that the receiver who has a public key pair (n, e) can
decipher the data by raising C to the value of the private key d and
reducing to modulo n.
ELLIPTIC CURVE CRYPTOGRAPHY (ECC)
• Based on the discrete logarithm problem over elliptic curves
• Uses finite fields (Galois fields) for operations
• Provides strong security with smaller key sizes
• Smaller key size than RSA for the same security level
• Example: 256-bit ECC ≈ 3072-bit RSA
• Efficient for embedded systems & resource-limited devices
• Elliptic Curve Diffie-Hellman (ECDH): Key exchange
• Elliptic Curve Digital Signature Algorithm (ECDSA): Digital signatures
• Encryption is possible but not commonly used for this purpose.
MATHEMATICS BEHIND ECC
• Elliptic Curve → Defined by Weierstrass Equation
• Generates a curve over a finite field
• Common field: Prime Field (� ₚ or Fₚ )
• An elliptic curve can be defined as an equation :
• Here, A and B belong to a finite field Zp or FP (prime finite field) along
with a special value called point of infinity.
• Point of infinity α is used to provide identity operations for points on
the curve.
• Non-Singular Condition
• Ensures the curve has no repeated roots
• Curve must be non-singular
MATHEMATICS BEHIND ECC
• A real number representation of
elliptic curve can be visualized
as shown in the following graph.
This is a graph of equation
over real numbers:
• Over real numbers, ECC
curves can be graphed
• Actual ECC works over finite
prime fields (Fₚ )
• Graphs help visualize point
operations
ELLIPTIC CURVE DISCRETE LOGARITHM PROBLEM
• A sufficiently large cyclic group is essential for constructing the discrete
logarithm problem using elliptic curves.
• Defined as a set of points that satisfy the elliptic curve equation.
• Group Operations on Elliptic Curves:
• Point Addition:
• Adding two distinct points on the curve.
• The result is another point on the curve.
• Point Doubling:
• Adding a point to itself.
• Used for scalar multiplication in cryptographic applications.
• Point addition and doubling can be represented graphically.
• These operations form the basis of elliptic curve cryptography (ECC).
POINT ADDITION ON ELLIPTIC CURVES
• A line is drawn through two points, P and Q,
on the elliptic curve.
• This line intersects the curve at a third point.
• The third intersection point is reflected
across the x-axis.
• The mirrored point is denoted as R = P + Q.
• The sum of two points, P and Q, is another
point R on the curve.
POINT ADDITION ON ELLIPTIC CURVES
• A line is drawn through two points, P and Q,
on the elliptic curve.
• This line intersects the curve at a third point.
• The third intersection point is reflected
across the x-axis.
• The mirrored point is denoted as R = P + Q.
• The sum of two points, P and Q, is another
point R on the curve.
• Group operation denoted by sign + for
addition yields the following equation:
• P+Q=R
POINT ADDITION ON ELLIPTIC CURVES
• In this case, two points are added in order to compute the coordinates of the
third point onthe curve:
• More precisely, this means that coordinates are added as shown in the
following equation:
• (x1, y1) + (x2, y2) = (x3, y3)
• The equation of point addition is as follows:
• Here, this is the result:
• S in the preceding equation depicts the line going through P and Q.
EXAMPLE: POINT ADDITION ON ELLIPTIC CURVES
• The graph on the left-hand side shows
the points that satisfy the equation
shown here:
• y2 =x3+7x+11
• The graph (left) shows 27 valid points
that satisfy the equation in
• Points P and Q are chosen for
addition.
• The right side displays the computed
third point � =� +�
• Line � represents the connection
through � and Q.
EXAMPLE: POINT ADDITION ON ELLIPTIC CURVES
• Consider x=3,y=6.
POINT DOUBLING ON ELLIPTIC CURVES
• Point doubling is the process of adding a
point P to itself on an elliptic curve.
• A tangent line is drawn at point P on the
curve.
• This line intersects the curve at a second
point.
• The intersection point is then mirrored
across the x-axis to get the result 2P = P + P.
POINT DOUBLING ON ELLIPTIC CURVES
• In case of point doubling, the equation becomes as follows:
• Here, S is the slope of tangent (tangent line) going through P.
EXAMPLE: POINT DOUBLING ON ELLIPTIC CURVES
• An example is shown here, which
shows the solutions and point
doubling of elliptic curve
• over finite field F23.
• The graph on the left-hand side
shows the points that satisfy the
equation:
• As shown earlier, on the right-hand
side, a calculation is shown that
finds the R after P is added into itself
(point doubling).
• There is no Q as here, the same
point P is used for doubling.
EXAMPLE: POINT DOUBLING ON ELLIPTIC CURVES
• An example is shown here, which shows the solutions and point doubling of
elliptic curve over finite field F23.
• The graph on the left-hand side shows the points that satisfy the equation:
• As shown earlier, on the right-hand side, a calculation is shown that finds the R
after P is added into itself (point doubling).
• There is no Q as here, the same point P is used for doubling.
• l is used to depict the tangent line going through P.
DISCRETE LOGARITHM PROBLEM
• Under specific conditions, all points on an elliptic curve form a cyclic group.
• Key Generation in ECC:
• Private Key (d): A randomly chosen integer.
• Public Key (T): Computed as a multiple of a generator point P on the curve:
• Discrete Logarithm Problem (DLP):
• Given an elliptic curve E, a generator point P, and a public key T, the goal is to
determine d such that:
• Here, d is the private key, and finding it from �
• T and P is computationally infeasible for large values.
• The difficulty of solving the discrete logarithm problem on elliptic curves makes
ECC highly secure for cryptographic applications.
DISCRETE LOGARITHM PROBLEM
• Consider an elliptic curve E, with two elements P and T. The discrete
logarithmic problem is to find the integer d, where 1 <= d <= #E, such that:
• Here, T is the public key (point on the curve) and d is the private key.
• public key is a random multiple of generator, whereas the private key is the
integer that is used to generate the multiple.
• #E represents the order of the elliptic curve, which basically means the
number of points that are present in the cyclic group of the elliptic curve.
• A cyclic group is formed by a combination of points on the elliptic curve and
point at infinity.
• A key pair is linked with specific domain parameters of an elliptic curve.
DISCRETE LOGARITHM PROBLEM
• Domain parameters include a field size, field representation, two elements from
the field a and b, two field elements Xg and Yg, order n of point G that is
calculated as G=(Xg, Yg) and the cofactor h = #E(Fq)/n
Add Your Website Enter title
Hash functions:
Compression of arbitrary
messages into fixed
l e n g t h d i g e s t
CRYPTOGRAPHIC PRIMITIVES
HASH FUNCTIONS
• Used to create fixed-length digests from arbitrarily long input strings.
• Keyless functions that ensure data integrity.
• Built using iterated and dedicated construction techniques.
• Families of Hash Functions:-MD (Message Digest family)
• SHA-1, SHA-2, SHA-3, RIPEMD (RACE Integrity Primitives Evaluation
Message Digest),Whirlpool
• Security Properties of Hash Functions
• Pre-image Resistance – Given a hash H, it should be infeasible to find
the original input M.
• Second Pre-image Resistance – Given an input M1, it should be hard to
find another M2 such that H(M1) = H(M2).
• Collision Resistance – It should be infeasible to find two different inputs
M1 ≠ M2 that produce the same hash H(M1) = H(M2).
HASH FUNCTIONS
• Used in digital signatures and message authentication codes (HMACs).
• Can function as one-way functions for cryptographic operations.
• Helps in constructing cryptographic primitives like MACs and PRNGs
(pseudorandom number generator) .
• Practical Properties:
• Efficiency: Fast computation for any input size.
• Deterministic: The same input always produces the same output.
• Security Properties:
• Pre-image resistance
• Second pre-image resistance
• Collision resistance
COMPRESSION OF ARBITRARY MESSAGES INTO FIXED
LENGTH DIGEST
• This property is concerned with the fact that a hash function must be able
to take a long input text of any length and output a fixed length
compressed message.
• Hash functions produce a compressed output in various bit sizes, usually
between 128-bits and 512-bits.
• Easy to compute
• Hash functions are efficient and fast one-way functions.
• The requirement is that they be very quick to compute regardless of the
message size.
• The efficiency may decrease if the message is too big but the function
should still be fast enough for practical use.
SECURITY PROPERTIES OF HASH FUNCTIONS
1. Pre-image Resistance (One-way Property)
• h(x) = y
• Here, h is the hash function, x is the input, and y is the hash.
• The first security property requires that y cannot be reverse computed to
x.
• x is considered a pre-image of y, hence the name pre-image resistanc
2. Second Pre-image Resistance (Weak Collision Resistance)
• This property requires that given x and h(x) , it is almost impossible to
find any other message m , where m != x and hash of m = hash of x.
h(m) = h(x).
• Prevents substitution attacks where a different input produces the same
hash.
SECURITY PROPERTIES OF HASH FUNCTIONS
3. Collision Resistance (Strong Collision Resistance)
• This property requires that two different input messages
should not hash to the same output.
• In other words, h(x) != h(z).
• Since hash functions map infinite inputs to finite outputs,
some collisions exist, but they should be hard to find.
• Avalanche Effect in Hash Functions
• A small change in input (even a single character) results
in a completely different hash output.
• A desirable property that enhances security.
HASH FUNCTION CONSTRUCTION TECHNIQUES
Iterated Hash Functions Approach
• Input is processed in multiple rounds, using a block-by-block
compression technique.
• Ensures a compact fixed-length hash output.
Merkle-Damgård Construction
• Input data is divided into equal-sized blocks.
• Each block is processed iteratively using a compression function.
• If the compression function is collision-resistant, the hash function is also
collision-resistant.
Other Compression Function Constructions
• Miyaguchi-Preneel ,Davies-Meyer
• Compression functions can be built using block ciphers for security.
Add Your Website Enter title
Message Digest (MD)
Message Digest (MD)
• Message Digest functions were very popular in early 1990s.
• MD4 and MD5 are members of this category.
• Both MD functions are found to be insecure and not recommended for
use any more.
• MD5 is a 128-bit hash function that was commonly used for file integrity
checks.
Add Your Website Enter title
Secure Hash Algorithms
( S H A s )
SECURE HASH ALGORITHMS (SHAS)
SHA-0
• 160-bit hash function, introduced by NIST in 1993.
• Quickly replaced due to security weaknesses.
SHA-1
• Improved version of SHA-0, still 160-bit.
• Widely used in SSL/TLS security protocols.
• Considered insecure—deprecated by Certificate Authorities.
SHA-2 Family
• Includes four variants based on hash length:
• SHA-224, SHA-256,SHA-384,SHA-512
• Stronger security compared to SHA-1.
SHA-3 Family
• Latest SHA standard, introduced by NIST.
• Variants: SHA3-224,SHA3-256,SHA3-384,SHA3-512
• Based on Keccak, using sponge construction instead of Merkle-Damgård.
Other Hash Function Families
RIPEMD (RACE Integrity Primitives Evaluation Message Digest)
• Inspired by MD4.
• Available in multiple versions:
• RIPEMD-128,RIPEMD-160,RIPEMD-256,RIPEMD-320
Whirlpool:
• This is based on a modified version of Rijndael cipher known as W.
• It uses the Miyaguchi-Preneel compression function, which is a type of
one-way function used for the compression of two fixed length inputs into
a single fixed length output.
• It is a single block length compression function:
Practical Applications of Hash Functions
• File Integrity Checks – Verifies data integrity.
• Password Storage – Securely stores passwords .
• Cryptographic Protocols – Used in digital signatures, HMACs, and
PRNGs.
• Data Structures – Power hash tables, distributed hash tables, and
bloom filters.
• Security Applications – Used in virus fingerprinting and P2P file sharing.
Role of Hash Functions in Blockchain
• Proof of Work (PoW):
• Uses SHA-256 twice to validate mining effort.
• Bitcoin Addresses:
• RIPEMD-160 is used to generate Bitcoin addresses.
SECURE HASH ALGORITHMS-256 (SHA-256)
• SHA-256 has the input message size < 2^64-bits. Block size is
512-bits and has a word size of 32-bits. Output is 256-bit digest.
• The compression function processes a 512-bit message block
and a 256-bit intermediate hash value.
• There are two main components of this function: compression
function and a message schedule.
• The algorithm works as follows:
• Pre-processing:
• 1. Padding of the message, which is used to make the length of a
block to 512-bits if it is smaller than the required block size of
512-bits.
• 2. Parsing the message into message blocks that ensure that the
message and its padding is divided into equal blocks of 512-bits.
SECURE HASH ALGORITHMS-256 (SHA-256)
• 3. Setting up the initial hash value, which is the eight 32-bit words obtained by
taking the first 32-bits of the fractional parts of the square roots of the first
eight prime numbers. These initial values are randomly chosen in order to
initialize the process and gives a level of confidence that no backdoor exists in
the algorithm.
• Hash computation:
• 1. Each message block is processed in a sequence and requires 64 rounds to
compute the full hash output. Each round uses slightly different constants to
ensure that no two rounds are the same.
• 2. First, the message schedule is prepared.
• 3. Then, eight working variables are initialized.
• 4. Then, the intermediate hash value is calculated.
• 5. Finally, the message is processed and the output hash is produced:
SECURE HASH ALGORITHMS-256 (SHA-256)
SECURE HASH ALGORITHMS-256 (SHA-256)
DESIGN OF SHA3 (KECCAK)
• Unlike SHA-1 & SHA-2, SHA-3 is based on un-keyed
permutations.
• No Merkle-Damgård: Uses a sponge construction instead.
• Sponge & Squeeze Construction: Works as a random permutation
model.
• Standard Variants:
• SHA3-224, SHA3-256, SHA3-384, SHA3-512
• Extendable Output Functions (XOFs):
• SHAKE128 & SHAKE256 – Output length can be extended as
needed.
• NIST Standardization: SHA-3 & SHAKE functions are officially
adopted.
DESIGN OF SHA3 (KECCAK)
• The following diagram shows the
sponge and squeeze model that is
the basis of SHA3 or Keccak.
• First, the data is absorbed into the
sponge after applying padding,
where it is then changed into a
subset of permutation state using
XOR and then the output is
squeezed out of the sponge function
that represents the transformed state.
• Rate is the input block size of a
sponge function, whereas capacity
determines the generic security
level:
MESSAGE AUTHENTICATION CODES (MACS)
• Definition: MACs (Keyed Hash Functions) ensure message integrity
and authentication.
• Purpose: Provide data origin authentication and protect against
tampering.
• Symmetric Cryptography: Uses a shared secret key between
sender and receiver.
• Construction Methods:
• Block Cipher-based MACs (e.g., CBC-MAC, CMAC)
• Hash Function-based MACs (e.g., HMAC)
• Usage: Common in secure communications, financial transactions,
and software integrity verification.
MACS USING BLOCK CIPHERS
• Uses Cipher Block Chaining (CBC) mode to generate MAC.
• Algorithm: Any block cipher (e.g., AES in CBC mode) can be used.
• MAC Generation:
• The last block of CBC encryption is used as the MAC.
• MAC length = Block size of the cipher.
• Verification:
– Compute the MAC of the received message.
– Compare it with the received MAC.
– If they match → Message integrity confirmed; otherwise, message altered.
• Limitation: Unlike digital signatures, MACs do not provide non-
repudiation (due to symmetric key usage).
HMAC(HASH-BASED MESSAGE AUTHENTICATION
CODE)
• Definition: Uses hash functions to generate a MAC for message integrity.
• Properties:
• Produces a fixed-length output.
• Can take an arbitrarily long message as input.
• Working Mechanism:
• Sender: Computes MAC using a hash function and shared key.
• Receiver: Verifies MAC using the same shared key.
• Key-Hashing Methods:
• Secret Prefix Method: Key prepended to the message before hashing.
• Secret Suffix Method: Key appended to the message before hashing.
• Commonly Used Algorithms: HMAC-SHA256, HMAC-SHA512 (widely used
in security protocols).
HMAC(HASH-BASED MESSAGE AUTHENTICATION
CODE)
• There are pros and cons of both methods.
Some attacks on both schemes have been
discovered.
• There are HMAC constructions schemes
that use various techniques, such as ipad
and opad (inner padding and outer
padding) proposed by researchers that are
considered secure with some assumptions:
Add Your Website Enter title
Merkle trees, Patricia
trees, Distributed hash
tables (DHTs),Digital
signatures,Elliptic Curve
Digital signature
algorithm (ECDSA)
MERKLE TREES
• Introduced By: Ralph Merkle
• Purpose: Enables secure and efficient verification of large data sets.
• Structure: A binary tree with hashed nodes.
• Construction Process:
– Leaf Nodes: Contain the original data (inputs).
– Internal Nodes: Computed by hashing pairs of child nodes.
– Merkle Root: The final single hash value at the top of the tree.
• Benefits:
– Ensures data integrity and efficient verification.
– Used in blockchains, cryptographic protocols, and secure data storage.
MERKLE TREES
PATRICIA TREES
• 1. Trie (Digital Tree)
• An ordered tree structure used to store datasets efficiently.
• 2. Patricia Tree (Radix Tree)
• Full Name: Practical Algorithm to Retrieve Information Coded in
Alphanumeric (Patricia).
• Compact Trie Representation:
• Nodes with a single child are merged with their parent.
• Improves space efficiency over a standard trie.
• 3. Merkle-Patricia Tree
• Combination of Merkle Tree & Patricia Tree.
PATRICIA TREES
• Structure:
• Uses Patricia tree compression for storage efficiency.
• Root node contains a hash of the entire data structure (like Merkle
trees).
• Applications:
• Ethereum Blockchain (stores account states & transactions).
• Used for efficient, secure data verification.
DISTRIBUTED HASH TABLES (DHTS)
• 1. Hash Table
• Definition: Maps keys to values using a hash function.
• Working:
• A hash function computes an index in an array of buckets.
• Data is stored and retrieved using hash keys.
• 2. Distributed Hash Table (DHT)
• Extension of Hash Table in a peer-to-peer (P2P) network.
• Nodes act as buckets, distributing data across multiple machines.
• Key Features:
• Decentralization: No central authority.
• Fault Tolerance: Data redundancy ensures reliability.
• Scalability: Efficient handling of large datasets.
DISTRIBUTED HASH TABLES (DHTS)
• Working Mechanism:
• Data is hashed to generate a
compact key.
• The key is linked to data and
stored across nodes.
• When requested, the filename
is rehashed to locate the key.
• Any node can retrieve the
corresponding data efficiently.
• Applications: Used in
BitTorrent, IPFS, blockchain
networks.
DIGITAL SIGNATURES
• Definition & Purpose
– Associate a message with its sender to ensure authenticity.
– Provide data origin authentication and non-repudiation.
• RSA Digital Signature Process
1. Hash Calculation:
• Compute the hash value of the data.
• Ensures data integrity (receiver can recompute and verify).
• Signing without hashing is insecure.
2. Signing the Hash:
• Hash is encrypted using the signer’s private key.
• Guarantees authenticity (only the signer has the private key).
DIGITAL SIGNATURES
• Key Properties
– Authenticity: Receiver can verify the signature.
– Unforgeability: Only the legitimate sender can generate the signature.
– Non-Reusability: The signature is bound to the specific message and
cannot be reused.
• Applications
• Secure communications, document verification, blockchain
transactions.
DIGITAL SIGNATURES
DIGITAL SIGNATURES
• Two Approaches for Secure & Authenticated Communication
• Sign Then Encrypt (More Secure)
• Step 1: Sender signs the data using their private key.
• Step 2: Signature is appended to the data.
• Step 3: The entire package (data + signature) is encrypted using
the receiver’s public key.
• Benefit: Ensures both authenticity and confidentiality before
transmission.
DIGITAL SIGNATURES
• Encrypt Then Sign
• Step 1: Sender encrypts the data using the receiver’s public key.
• Step 2: The encrypted data is then signed using the sender’s
private key.
• Limitation: Signature verification happens after decryption, making
it less secure than "Sign Then Encrypt".
• Digital Certificates & Certificate Authority (CA)
• A CA issues digital certificates to associate a public key with an
identity.
• Certificates help in verifying authenticity and preventing
impersonation.
ELLIPTIC CURVE DIGITAL SIGNATURE ALGORITHM
(ECDSA)
• In order to sign and verify using the ECDSA scheme, the first key pair
needs to be generated:
• 1. First, define an elliptic curve E with domain parameters:
– 1. With modulus P.
– 2. Coefficients a and b.
– 3. Generator point A that forms a cyclic group of prime order q.
ECDSA Key Generation
• 2. An integer d is chosen randomly so that 0 < d < q.
• 3. Calculate public key B so that B = d A.
• Public key, B is of the form : Kpb = (p,a,b,q,A,B)
• Private key is randomly chosen d in Step 2: Kpr = d
ECDSA SIGNATURE GENERATION
• Now the signature can be generated using the private and public key.
• 1. First, an ephemeral key(per message secret key) Ke is chosen,
where 0 < Ke < q. It should be ensured that Ke is truly random, and no
two signatures have the same key;
• otherwise, the private key can be calculated.
• 2. Another value R is calculated using R = Ke A, that is, by multiplying
A (the generator point) and the random ephemeral key.
• 3. Initialize a variable r with the x coordinate value of point R.
• r = xR.
ELLIPTIC CURVE DIGITAL SIGNATURE ALGORITHM
(ECDSA)
• To sign Message m=h(m)
• The signature can be calculated as follows:
• Here, m is the message for which the signature is being computed
and h(m) is the hash of the message m.
• Signature verification is carried out by following this process.
• 1. Auxiliary value w is calculated as w = s-1mod q.
• 2. Auxiliary value u1 = w. h(m) mod q.
• 3. Auxiliary value u2 = w. r mod q.
• 4. Calculate Point P, P = u1A + u2B.
ELLIPTIC CURVE DIGITAL SIGNATURE ALGORITHM
(ECDSA)
• 5. Verification is carried out as follows.
• 6. r, s is accepted as a valid signature if x-coordinate of the point P
calculated in Step 4 has the same value as the signature parameter r
mod q.
• that is: Xp = r mod q means valid signature
• Xp != r mod q means invalid signature
HOMOMORPHIC ENCRYPTION
• Public key cryptosystems can be partially homomorphic (PHE).
• Examples:
– Multiplicative PHE – RSA
– Additive PHE – Paillier
• PHEs are useful in e-voting and banking applications.
• Fully Homomorphic Encryption (FHE)
• Introduced by Craig Gentry in 2009.
• Supports both multiplication and addition on encrypted data.
• Allows computation on encrypted data without decryption.
HOMOMORPHIC ENCRYPTION
• Privacy-preserving cloud computing.
• Secure online search engines.
• Protects sensitive data while allowing computation.
• Recent Developments in FHE
– Researchers working to improve efficiency and practicality.
– High computational cost remains a challenge.
– Growing interest in making FHE more widely applicable.
• FHE and Blockchain
– Enhances confidentiality and privacy in blockchain.
– Can address data privacy concerns in decentralized systems.
– Future potential in secure smart contracts and private transactions.
HOMOMORPHIC ENCRYPTION
• Conclusion
• FHE is a breakthrough in encryption technology.
• Offers privacy in untrusted environments.
• Future developments will drive its adoption in finance, healthcare, and
blockchain.
SIGNCRYPTION
• A public key cryptographic primitive.
• Provides both digital signature and encryption in a single step.
• Invented by Yuliang Zheng.
• Standardized as ISO/IEC 29150:2011.
• Traditional methods:
• Sign-then-Encrypt and Encrypt-then-Sign
• These methods provide:
– Unforgeability
– Authentication
– Non-repudiation
• Signcryption advantage:
• Combines both processes in a single logical step.
SIGNCRYPTION
• Traditional method:
• Cost (Signature) + Cost (Encryption)
• Signcryption:
• Cost (Signcryption) << Cost (Signature) + Cost (Encryption)
• More efficient and secure than separate processes.
ZERO knowledge proofs
• Introduced by GoldWasser, Micali, and Rackoff.
• These proofs are used to prove the validity of an assertion without
revealing any information whatsoever about the assertion.
• Three properties of ZKPs : completeness, soundness, and zero-
knowledge property.
• Completeness ensures that if a certain assertion is true, then the
verifier will be convinced of this claim by the prover.
• The soundness property makes sure that if an assertion is false,
then no dishonest prover can convince the verifier otherwise.
• Zero-knowledge property: It is ensured that absolutely nothing is
revealed about the assertion except whether it is true or false.
ZERO knowledge proofs
• Enables privacy-preserving authentication.
• Prevents unnecessary data exposure.
• Used in security-sensitive fields like finance, law, and medicine.
• Privacy is crucial for decentralized systems.
• A recent example of the successful implementation of the zero knowledge
proof mechanism is the Zcash crypto currency.
• In Zcash, a specific type of zero knowledge proof, known as zero-
knowledge Succinct Non-interactive Argument of Knowledge (ZK-Snark), is
implemented
BLIND SIGNATURES
• Blind signatures were introduced by David Chaum in 1982 and are based on
public key digital signature schemes, such as RSA.
• The key idea behind blind signatures is to get the message signed by the
signer without actually revealing the message.
• This is achieved by disguising or blinding the message before signing it,
hence the name blind signatures.
• This blind signature can then be verified against the original message just
like a normal digital signature.
• Blind signatures were introduced as a mechanism to allow the development
of digital cash schemes.
ENCODING SCHEMES
• Binary-to-Text Encoding
• Used to convert binary data into text for processing, storage, or transmission.
• Helps in scenarios where protocols do not support binary data.
• Images stored as Base64 in databases for compatibility.
• Facilitates text-based storage of binary data in various applications.
• Base64: Commonly used binary-to-text encoding scheme.
• Converts binary data into ASCII characters.
• Base58 Encoding: Popularized by Bitcoin.
• Similar to Base64 but removes visually confusing characters (e.g., 0, O, I, l).
Add Your Website Enter title
T H A N K S
Enter title