0% found this document useful (0 votes)
23 views

unit 3 and 4

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)
23 views

unit 3 and 4

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/ 29

Unit 3:

The RSA algorithm (Rivest-Shamir-Adleman) is one of the most widely used public-key
cryptosystems. It enables secure data transmission, ensuring both confidentiality and authentication.
RSA is based on the mathematical properties of large prime numbers, which makes it
computationally difficult to reverse the encryption without knowing the private key.

Steps of RSA Algorithm

1. Key Generation: The first step in the RSA algorithm is generating the public and private keys.
These keys are used for encryption and decryption.

o Step 1: Choose two distinct large prime numbers, ppp and qqq.

▪ These prime numbers should be chosen randomly and kept secret.

o Step 2: Compute nnn, the product of ppp and qqq:

n=p×qn = p \times qn=p×q

▪ nnn is used as the modulus for both the public and private keys.

o Step 3: Calculate ϕ(n)\phi(n)ϕ(n) (Euler's totient function), where:

ϕ(n)=(p−1)×(q−1)\phi(n) = (p - 1) \times (q - 1)ϕ(n)=(p−1)×(q−1)

▪ ϕ(n)\phi(n)ϕ(n) represents the number of integers less than nnn that are
coprime with nnn.

o Step 4: Choose an integer eee such that 1<e<ϕ(n)1 < e < \phi(n)1<e<ϕ(n) and eee is
coprime to ϕ(n)\phi(n)ϕ(n) (i.e., gcd⁡(e,ϕ(n))=1\gcd(e, \phi(n)) = 1gcd(e,ϕ(n))=1).

▪ The value eee becomes the public key exponent.

o Step 5: Determine ddd, the modular multiplicative inverse of eee mod


ϕ(n)\phi(n)ϕ(n), such that:

e×d≡1 (mod ϕ(n))e \times d \equiv 1 \ (\text{mod} \ \phi(n))e×d≡1 (mod ϕ(n))

▪ ddd is the private key exponent.

2. Public and Private Keys:

o The public key is the pair (e,n)(e, n)(e,n).

o The private key is the pair (d,n)(d, n)(d,n).

o nnn is part of both keys, while eee is used for encryption and ddd is used for
decryption. The private key ddd must be kept secret.

Encryption (Using Public Key):

To encrypt a message MMM (which is represented as a numerical value):

1. Convert the message MMM into an integer such that 0≤M<n0 \leq M < n0≤M<n.

2. Compute the ciphertext CCC using the public key (e,n)(e, n)(e,n): C=Me mod nC = M^e \
\text{mod} \ nC=Me mod n
3. The ciphertext CCC is then sent to the recipient.

Decryption (Using Private Key):

To decrypt the ciphertext CCC, the recipient uses their private key (d,n)(d, n)(d,n):

1. Compute the original message MMM using: M=Cd mod nM = C^d \ \text{mod} \
nM=Cd mod n

2. The decrypted value MMM is the original message.

Example of RSA Encryption and Decryption

1. Key Generation:

o Choose two prime numbers, p=61p = 61p=61 and q=53q = 53q=53.

o Compute n=61×53=3233n = 61 \times 53 = 3233n=61×53=3233.

o Compute ϕ(n)=(61−1)×(53−1)=60×52=3120\phi(n) = (61 - 1) \times (53 - 1) = 60


\times 52 = 3120ϕ(n)=(61−1)×(53−1)=60×52=3120.

o Choose e=17e = 17e=17, which is coprime to ϕ(n)=3120\phi(n) = 3120ϕ(n)=3120


(i.e., gcd⁡(17,3120)=1\gcd(17, 3120) = 1gcd(17,3120)=1).

o Compute ddd such that 17×d≡1 (mod 3120)17 \times d \equiv 1 \ (\text{mod} \
3120)17×d≡1 (mod 3120). We find d=2753d = 2753d=2753.

o Public key: (e=17,n=3233)(e = 17, n = 3233)(e=17,n=3233)

o Private key: (d=2753,n=3233)(d = 2753, n = 3233)(d=2753,n=3233)

2. Encryption:

o Suppose the message M=65M = 65M=65 (in integer form).

o Compute the ciphertext: C=6517 mod 3233=2790C = 65^{17} \ \text{mod} \ 3233 =


2790C=6517 mod 3233=2790

o The encrypted message is C=2790C = 2790C=2790.

3. Decryption:

o To recover the original message: M=27902753 mod 3233=65M = 2790^{2753} \


\text{mod} \ 3233 = 65M=27902753 mod 3233=65

o The decrypted message is M=65M = 65M=65.

Key Properties of RSA

• Asymmetric Encryption: RSA uses different keys for encryption (public) and decryption
(private), allowing secure communication without requiring the parties to share a secret key
beforehand.

• Security: The security of RSA relies on the difficulty of factoring large integers (specifically
the modulus nnn, which is the product of two large primes). As the size of nnn increases, the
difficulty of breaking RSA increases.
• Key Length: Common key sizes for RSA range from 1024 to 4096 bits. Larger key sizes provide
more security but require more computational power.

Applications of RSA

• Digital Signatures: RSA can be used to sign messages digitally. The sender uses their private
key to sign the message, and the recipient verifies the signature using the sender’s public
key.

• Secure Communication: RSA is commonly used in secure protocols like SSL/TLS (used for
HTTPS) to encrypt data during transmission.

• Key Exchange: RSA is often used in combination with symmetric encryption algorithms. RSA
encrypts the symmetric key, which is then used to encrypt the actual message (since
symmetric encryption is faster).

Conclusion

RSA is a powerful cryptographic algorithm used for secure data transmission and digital signatures.
Its security depends on the computational difficulty of factoring large numbers. Proper key
management and key length are critical to maintaining the security and effectiveness of RSA
encryption in modern applications.

The RSA (Rivest-Shamir-Adleman) algorithm is one of the first public-key cryptosystems and is widely
used for secure data transmission. The mathematical foundations of the RSA algorithm rely on
number theory concepts such as prime factorization, modular arithmetic, and the properties of
Euler's Totient function.

Here is a detailed step-by-step breakdown of the mathematical foundations of the RSA algorithm:

1. Prime Numbers:

RSA requires the selection of two large prime numbers for its security.

• Let ppp and qqq be two distinct large prime numbers.

• The product of these two primes is used to calculate the modulus nnn: n=p×qn = p \times
qn=p×q This nnn is used as part of both the public and private keys.

2. Modulus nnn:

The modulus nnn is a key component of RSA. It is the product of the two primes and serves as the
base for the modulo operations in both the encryption and decryption processes.

n=p×qn = p \times qn=p×q

The difficulty of factoring nnn into its prime components ppp and qqq underpins the security of RSA.
With large enough primes, factorization becomes computationally infeasible.

3. Euler's Totient Function ϕ(n)\phi(n)ϕ(n):

Euler's Totient function ϕ(n)\phi(n)ϕ(n) is a critical part of the RSA algorithm. It gives the number of
integers less than nnn that are relatively prime to nnn. For RSA, since nnn is the product of two
primes, we can compute ϕ(n)\phi(n)ϕ(n) as:
ϕ(n)=(p−1)(q−1)\phi(n) = (p-1)(q-1)ϕ(n)=(p−1)(q−1)

This is derived from the fact that for a prime number ppp, ϕ(p)=p−1\phi(p) = p-1ϕ(p)=p−1.

4. Public Key eee:

The public key exponent eee is chosen such that:

• 1<e<ϕ(n)1 < e < \phi(n)1<e<ϕ(n)

• eee is coprime to ϕ(n)\phi(n)ϕ(n), meaning gcd⁡(e,ϕ(n))=1\gcd(e, \phi(n)) = 1gcd(e,ϕ(n))=1.

This ensures that eee has a multiplicative inverse modulo ϕ(n)\phi(n)ϕ(n), which is required for
decryption.

5. Private Key ddd:

The private key exponent ddd is computed as the modular multiplicative inverse of eee modulo
ϕ(n)\phi(n)ϕ(n). That is, ddd satisfies the equation:

e×d≡1 (mod ϕ(n))e \times d \equiv 1 \ (\text{mod} \ \phi(n))e×d≡1 (mod ϕ(n))

This can be calculated using the Extended Euclidean Algorithm, which finds the inverse of eee
modulo ϕ(n)\phi(n)ϕ(n).

6. Key Generation:

The key generation process can be summarized as:

1. Choose two large prime numbers ppp and qqq.

2. Compute n=p×qn = p \times qn=p×q.

3. Compute ϕ(n)=(p−1)(q−1)\phi(n) = (p-1)(q-1)ϕ(n)=(p−1)(q−1).

4. Choose eee such that 1<e<ϕ(n)1 < e < \phi(n)1<e<ϕ(n) and gcd⁡(e,ϕ(n))=1\gcd(e, \phi(n)) =
1gcd(e,ϕ(n))=1.

5. Compute ddd, the modular inverse of eee modulo ϕ(n)\phi(n)ϕ(n).

The public key is (e,n)(e, n)(e,n), and the private key is (d,n)(d, n)(d,n).

7. Encryption:

Encryption in RSA is done using the public key. The plaintext message MMM is transformed into
ciphertext CCC using the formula:

C=Memod nC = M^e \mod nC=Memodn

Here, MMM is the numerical representation of the message (typically converted to an integer), eee
is the public key exponent, and nnn is the modulus.

8. Decryption:

Decryption is done using the private key. The ciphertext CCC is transformed back into the plaintext
message MMM using the formula:

M=Cdmod nM = C^d \mod nM=Cdmodn


Here, CCC is the ciphertext, ddd is the private key exponent, and nnn is the modulus.

9. Mathematical Properties Ensuring Correctness:

The correctness of the RSA algorithm relies on the properties of modular arithmetic. Specifically, for
the RSA encryption and decryption process to work, the following condition must hold:

Med≡M (mod n)M^{ed} \equiv M \ (\text{mod} \ n)Med≡M (mod n)

This is guaranteed by Euler's theorem, which states that for any integer MMM such that
gcd⁡(M,n)=1\gcd(M, n) = 1gcd(M,n)=1:

Mϕ(n)≡1 (mod n)M^{\phi(n)} \equiv 1 \ (\text{mod} \ n)Mϕ(n)≡1 (mod n)

Using the fact that ed≡1 (mod ϕ(n))ed \equiv 1 \ (\text{mod} \ \phi(n))ed≡1 (mod ϕ(n)), it follows
that:

Med≡M1+kϕ(n)=M×(Mϕ(n))k≡M (mod n)M^{ed} \equiv M^{1 + k\phi(n)} = M \times (M^{\phi(n)})^k


\equiv M \ (\text{mod} \ n)Med≡M1+kϕ(n)=M×(Mϕ(n))k≡M (mod n)

This ensures that after encrypting with the public key and decrypting with the private key, we recover
the original message.

Example of Applying RSA Mathematically:

Key Generation:

• Select primes: p=7p = 7p=7, q=11q = 11q=11

• Compute n=7×11=77n = 7 \times 11 = 77n=7×11=77

• Compute ϕ(n)=(7−1)(11−1)=6×10=60\phi(n) = (7-1)(11-1) = 6 \times 10 =


60ϕ(n)=(7−1)(11−1)=6×10=60

• Choose e=17e = 17e=17 (where gcd⁡(17,60)=1\gcd(17, 60) = 1gcd(17,60)=1)

• Compute ddd, the modular inverse of 17mod 6017 \mod 6017mod60, using the Extended
Euclidean Algorithm: d=53d = 53d=53

Encryption:

• Given M=8M = 8M=8 (the message to encrypt),

C=817mod 77C = 8^{17} \mod 77C=817mod77

Using modular exponentiation, C=30C = 30C=30.

Decryption:

• Decrypt the ciphertext C=30C = 30C=30 using the private key d=53d = 53d=53,

M=3053mod 77M = 30^{53} \mod 77M=3053mod77

Using modular exponentiation, M=8M = 8M=8, recovering the original message.


Summary of RSA’s Mathematical Foundations:

• RSA relies on prime factorization, modular arithmetic, and Euler's Totient function.

• Public key eee is chosen such that it is coprime with ϕ(n)\phi(n)ϕ(n).

• Private key ddd is the modular inverse of emod ϕ(n)e \mod \phi(n)emodϕ(n).

• Encryption: C=Memod nC = M^e \mod nC=Memodn.

• Decryption: M=Cdmod nM = C^d \mod nM=Cdmodn.

4o

The Diffie-Hellman key exchange allows two users, A and B, to securely share a secret key over an
insecure channel using the mathematical principles of modular arithmetic. Here, we will use the
provided values of q=11q = 11q=11 (the prime number) and α=7\alpha = 7α=7 (the primitive root).
Let's go through the steps to find the public keys for both users and compute the shared secret key.

Given:

• Prime number q=11q = 11q=11

• Primitive root α=7\alpha = 7α=7

• Private key of User A: XA=3X_A = 3XA=3

• Private key of User B: XB=6X_B = 6XB=6

Step 1: Public Key Calculation

Each user calculates their public key using the formula:

Y=αXmod qY = \alpha^X \mod qY=αXmodq

(i) User A's Public Key:

• Private key of A: XA=3X_A = 3XA=3

• The public key of A, YAY_AYA, is computed as: YA=αXAmod q=73mod 11Y_A = \alpha^{X_A}
\mod q = 7^3 \mod 11YA=αXAmodq=73mod11 First, calculate 73=3437^3 = 34373=343, and
then: YA=343mod 11=2Y_A = 343 \mod 11 = 2YA=343mod11=2

Thus, A’s public key is YA=2Y_A = 2YA=2.

(ii) User B's Public Key:

• Private key of B: XB=6X_B = 6XB=6

• The public key of B, YBY_BYB, is computed as: YB=αXBmod q=76mod 11Y_B = \alpha^{X_B}
\mod q = 7^6 \mod 11YB=αXBmodq=76mod11 First, calculate 76=1176497^6 =
11764976=117649, and then: YB=117649mod 11=4Y_B = 117649 \mod 11 = 4YB
=117649mod11=4

Thus, B’s public key is YB=4Y_B = 4YB=4.

Step 2: Shared Secret Key Calculation


Once the public keys YAY_AYA and YBY_BYB are exchanged, each user can compute the shared secret
key using the formula:

Shared Secret Key=Yother userXcurrent usermod q\text{Shared Secret Key} = Y_{\text{other


user}}^{X_{\text{current user}}} \mod qShared Secret Key=Yother userXcurrent usermodq

(iii) Shared Secret Key for User A:

• A uses B’s public key YB=4Y_B = 4YB=4 and A’s private key XA=3X_A = 3XA=3:
Shared Key for A=YBXAmod q=43mod 11\text{Shared Key for A} = Y_B^{X_A} \mod q = 4^3
\mod 11Shared Key for A=YBXAmodq=43mod11 First, calculate 43=644^3 = 6443=64, and
then: Shared Key for A=64mod 11=9\text{Shared Key for A} = 64 \mod 11 =
9Shared Key for A=64mod11=9

Shared Secret Key for User B:

• B uses A’s public key YA=2Y_A = 2YA=2 and B’s private key XB=6X_B = 6XB=6:
Shared Key for B=YAXBmod q=26mod 11\text{Shared Key for B} = Y_A^{X_B} \mod q = 2^6
\mod 11Shared Key for B=YAXBmodq=26mod11 First, calculate 26=642^6 = 6426=64, and
then: Shared Key for B=64mod 11=9\text{Shared Key for B} = 64 \mod 11 =
9Shared Key for B=64mod11=9

Thus, the shared secret key is 9 for both User A and User B.

Final Results:

• User A's Public Key YAY_AYA = 2

• User B's Public Key YBY_BYB = 4

• Shared Secret Key = 9

Diffie-Hellman Key Exchange Algorithm:

Here’s a summary of the algorithm used in Diffie-Hellman Key Exchange:

1. Select a large prime number qqq and a primitive root α\alphaα modulo qqq:

o These are public parameters and are known to both users.

2. User A selects a private key XAX_AXA:

o This private key is kept secret.

o User A computes their public key YA=αXAmod qY_A = \alpha^{X_A} \mod qYA=αXA
modq and sends it to User B.

3. User B selects a private key XBX_BXB:

o This private key is kept secret.

o User B computes their public key YB=αXBmod qY_B = \alpha^{X_B} \mod qYB=αXB
modq and sends it to User A.

4. Both users compute the shared secret key:


o User A computes the shared secret key as (YB)XAmod q(Y_B)^{X_A} \mod q(YB)XA
modq.

o User B computes the shared secret key as (YA)XBmod q(Y_A)^{X_B} \mod q(YA)XB
modq.

The result is the same for both users and becomes the shared secret key for secure communication.

The Diffie-Hellman algorithm is a secure way of establishing a shared secret key over an insecure
channel, which can then be used for encryption in symmetric key algorithms. The security comes
from the difficulty of solving the discrete logarithm problem.

ChatGPT

Certainly! Here’s a comprehensive explanation of the Diffie-Hellman key exchange technique,


structured to cover essential aspects while meeting a 15-mark requirement. This includes the
background theory, step-by-step computations for both users, and the shared secret key derivation,
as well as a brief conclusion.

Diffie-Hellman Key Exchange Technique

Introduction

The Diffie-Hellman key exchange is a foundational method in modern cryptography, enabling two
parties to securely share a secret key over an insecure communication channel. It is based on the
principles of modular arithmetic and the Discrete Logarithm Problem (DLP). This exchange allows
users to derive a common key for subsequent symmetric encryption, ensuring the confidentiality of
their communication.

Key Concepts

1. Modular Arithmetic: This mathematical operation involves numbers wrapping around upon
reaching a specified modulus. It is fundamental in cryptography, especially for operations
involving large primes.

2. Primitive Root: A number α\alphaα is a primitive root modulo qqq if it can generate all
integers from 111 to q−1q-1q−1 through exponentiation. The existence of such roots is
essential for the Diffie-Hellman process.

3. Discrete Logarithm Problem: Given a prime qqq and a primitive root α\alphaα, it is
computationally difficult to find XXX if you only know Y=αXmod qY = \alpha^X \mod
qY=αXmodq. This property underpins the security of the Diffie-Hellman exchange.

Given Parameters

• Prime number q=11q = 11q=11

• Primitive root α=7\alpha = 7α=7

• Private key of User A XA=3X_A = 3XA=3

• Private key of User B XB=6X_B = 6XB=6


Step-by-Step Execution

Step 1: Calculate Public Keys

Each user computes their public key using the formula:

Y=αXmod qY = \alpha^{X} \mod qY=αXmodq

(i) User A's Public Key:

User A computes:

YA=αXAmod q=73mod 11Y_A = \alpha^{X_A} \mod q = 7^3 \mod 11YA=αXAmodq=73mod11

• Calculate 73=3437^3 = 34373=343

• Now find 343mod 11343 \mod 11343mod11: 343÷11=31(Remainder = 2)343 \div 11 = 31


\quad \text{(Remainder = 2)}343÷11=31(Remainder = 2)

• Thus, YA=2Y_A = 2YA=2.

(ii) User B's Public Key:

User B computes:

YB=αXBmod q=76mod 11Y_B = \alpha^{X_B} \mod q = 7^6 \mod 11YB=αXBmodq=76mod11

• Calculate 76=1176497^6 = 11764976=117649

• Now find 117649mod 11117649 \mod 11117649mod11:


117649÷11=10604(Remainder = 4)117649 \div 11 = 10604 \quad \text{(Remainder =
4)}117649÷11=10604(Remainder = 4)

• Thus, YB=4Y_B = 4YB=4.

Step 2: Compute Shared Secret Key

Once the public keys are exchanged, both users compute the shared secret key.

(iii) Shared Secret Key Calculation:

1. For User A:

o A uses B's public key YBY_BYB and A's private key XAX_AXA:

KA=YBXAmod q=43mod 11K_A = Y_B^{X_A} \mod q = 4^3 \mod 11KA=YBXAmodq=43mod11

o Calculate 43=644^3 = 6443=64.

o Now find 64mod 1164 \mod 1164mod11:

64÷11=5(Remainder = 9)64 \div 11 = 5 \quad \text{(Remainder = 9)}64÷11=5(Remainder = 9)

o Thus, KA=9K_A = 9KA=9.

2. For User B:

o B uses A's public key YAY_AYA and B's private key XBX_BXB:

KB=YAXBmod q=26mod 11K_B = Y_A^{X_B} \mod q = 2^6 \mod 11KB=YAXBmodq=26mod11


o Calculate 26=642^6 = 6426=64.

o Now find 64mod 1164 \mod 1164mod11:

64÷11=5(Remainder = 9)64 \div 11 = 5 \quad \text{(Remainder = 9)}64÷11=5(Remainder = 9)

o Thus, KB=9K_B = 9KB=9.

Final Results

• User A's Public Key YA=2Y_A = 2YA=2

• User B's Public Key YB=4Y_B = 4YB=4

• Shared Secret Key K=9K = 9K=9

Conclusion

The Diffie-Hellman key exchange provides a secure method for two parties to establish a shared
secret key over an insecure channel. In this example, both users A and B successfully computed the
shared secret key K=9K = 9K=9 using their respective private keys and the exchanged public keys. This
process exemplifies the efficiency and security of the Diffie-Hellman algorithm, which remains a
fundamental technique in modern cryptographic systems.

Additional Notes:

• Security Considerations: While the Diffie-Hellman method is secure against eavesdroppers


due to the hardness of the discrete logarithm problem, it does not authenticate the users.
Hence, it is often used alongside other cryptographic techniques to ensure the authenticity
of the communicating parties.

This structured approach should cover the necessary details and be suitable for a 15-mark
assessment on the Diffie-Hellman key exchange technique, demonstrating an understanding of the
concepts, computations, and implications of the method.

4o mini

Unit4:

Hash algorithm:

https://www.geeksforgeeks.org/sha-1-hash-in-java/

### SHA-1 (Secure Hash Algorithm 1)


SHA-1, or Secure Hash Algorithm 1, is a cryptographic hash function designed by the National
Security Agency (NSA) and published by the National Institute of Standards and Technology (NIST) in
1995. SHA-1 produces a 160-bit (20-byte) hash value, typically rendered as a hexadecimal number
consisting of 40 digits. It is widely used for integrity verification, digital signatures, and various
security applications.

### Key Features of SHA-1

- **Hash Length**: Produces a fixed-length output of 160 bits (20 bytes).

- **Input Size**: Can accept an input of any length but processes data in blocks of 512 bits (64
bytes).

- **Deterministic**: The same input will always produce the same hash output.

- **Fast Computation**: Designed to be computationally efficient on a wide range of hardware.

- **Collision Resistance**: It should be infeasible to find two different inputs that produce the same
hash output.

- **Pre-image Resistance**: Given a hash value, it should be infeasible to find an input that hashes
to that value.

### Structure of SHA-1

SHA-1 consists of several key steps: message padding, parsing the padded message into blocks,
initializing variables, processing the message blocks, and producing the final hash.

#### Step-by-Step Process of SHA-1

1. **Message Padding**:

- The original message is padded so that its length is congruent to 448 modulo 512. This ensures
that the message length is a multiple of 512 bits.

- Padding is done by adding a single '1' bit followed by the necessary number of '0' bits to make the
total length 448 bits. Finally, the original message length (in bits) is appended as a 64-bit integer.

2. **Message Parsing**:

- The padded message is divided into blocks of 512 bits (64 bytes), resulting in multiple 512-bit
blocks.
3. **Initialization**:

- SHA-1 uses five 32-bit variables, initialized to specific constant values (A, B, C, D, E):

- \( A = 0x67452301 \)

- \( B = 0xEFCDAB89 \)

- \( C = 0x98BADCFE \)

- \( D = 0x10325476 \)

- \( E = 0xC3D2E1F0 \)

4. **Processing the Message Blocks**:

- Each 512-bit block is divided into sixteen 32-bit words.

- The words are expanded into eighty 32-bit words using bitwise operations.

- The core of SHA-1 consists of a series of logical functions and bitwise operations. Each of the 80
rounds applies specific transformations and updates the values of A, B, C, D, and E based on the
message words and constants.

5. **Final Hash Computation**:

- After processing all blocks, the final hash is obtained by concatenating the values of A, B, C, D, and
E, producing a 160-bit output.

### SHA-1 Flowchart

Here is a simplified flowchart diagram illustrating the SHA-1 algorithm:

```

+---------------------+

| Input Message |

+---------------------+

+---------------------+

| Message Padding |

| (Length = 448 mod 512) |


+---------------------+

+---------------------+

| Parse Message |

| into 512-bit |

| Blocks |

+---------------------+

+---------------------+

| Initialize Hash |

| Variables (A, B, |

| C, D, E) |

+---------------------+

+---------------------+

| Process Each Block |

| (Update A, B, C, |

| D, E) |

+---------------------+

+---------------------+

| Final Hash |

| (A || B || C || D || E) |

+---------------------+

+---------------------+
| Output Hash |

+---------------------+

```

### Security and Vulnerabilities

SHA-1 was widely used for many years, but it has been found to have significant vulnerabilities:

1. **Collision Vulnerability**: Researchers demonstrated that it is feasible to generate two different


inputs that produce the same hash output, a property known as a collision. The first practical
collision was reported in 2017.

2. **Deprecation**: Due to its vulnerabilities, many organizations have moved to more secure hash
functions, such as SHA-256 or SHA-3. As of 2011, NIST has recommended transitioning away from
SHA-1.

### Conclusion

SHA-1 was a pioneering cryptographic hash function that played a significant role in various security
protocols and applications. However, due to its vulnerabilities and the emergence of more secure
alternatives, it is no longer considered safe for cryptographic purposes. Organizations are encouraged
to adopt stronger hash functions to ensure the integrity and security of their data.

### References

For further reading on SHA-1 and cryptographic hash functions, you can refer to:

- **National Institute of Standards and Technology (NIST)** documentation.

- Cryptography textbooks that cover hashing algorithms in detail.

Authentication functions are crucial components in ensuring the integrity and security of systems by
verifying the identity of users and devices. This analysis classifies authentication functions based on
several criteria, including type, method, principles, use cases, and protocols, providing a
comprehensive understanding of their roles in cybersecurity.

1. Classification by Type of Authentication


a. User Authentication

• Password-Based Authentication: This is the most traditional method where users create
passwords to verify their identities. It is widely used but can be susceptible to attacks like
brute-force and phishing.

• Two-Factor Authentication (2FA): Enhances security by requiring two different types of


credentials. For example, a user might enter a password and then receive a one-time code
via SMS or an authentication app.

• Biometric Authentication: Utilizes unique physical traits such as fingerprints, facial


recognition, or iris scans. Biometric authentication is gaining popularity due to its high level
of security and user convenience.

b. Device Authentication

• Token-Based Authentication: Each device is assigned a unique token, which is used to


authenticate the device in a network. This can be a physical device or a software-based
token.

• Digital Certificates: Devices use digital certificates issued by a trusted Certificate Authority
(CA) to authenticate themselves. This method is common in SSL/TLS communications.

c. Data Authentication

• Message Authentication Codes (MAC): This method ensures both the integrity and
authenticity of a message. A secret key is combined with the message to produce a hash-like
value, which can be verified by the receiver.

• Digital Signatures: Utilizes asymmetric cryptography to provide proof of the authenticity of a


message or document. The sender signs the data with their private key, and the recipient can
verify it using the sender's public key.

2. Classification by Method of Authentication

a. Synchronous Authentication

• Users must provide the same credentials each time they authenticate. This includes
passwords, PINs, or biometric data. This method can be vulnerable to interception.

b. Asynchronous Authentication

• In this method, the user’s credentials are verified based on a challenge-response mechanism.
For example, the system sends a challenge, and the user responds with the correct answer,
such as a security question or a one-time password.

3. Classification by Underlying Principles

a. Symmetric Authentication

• Involves shared secret keys between the user and the system. Both parties must keep the key
confidential. Examples include using passwords and symmetric encryption for
authentication.

b. Asymmetric Authentication
• Utilizes a pair of keys: a public key (shared openly) and a private key (kept secret).
Authentication is achieved using digital signatures and certificates. The private key is used for
signing, while the public key is used for verification.

4. Classification by Use Cases

a. Authentication in Networks

• Used to authenticate users and devices in computer networks, such as Wi-Fi authentication
(WPA2), VPN connections, and network devices.

b. Authentication in Web Applications

• Implemented in web applications to secure user accounts, such as login systems, e-


commerce platforms, and online banking. This often involves cookies, sessions, and tokens.

c. Authentication in APIs

• Involves verifying the identity of applications or services accessing an API. Common methods
include API keys, OAuth tokens, and JWT (JSON Web Tokens), which allow for secure
interactions between client and server.

5. Authentication Protocols

a. Challenge-Response Protocols

• Require the user to respond to a challenge issued by the system, preventing replay attacks.
The system generates a challenge that only the legitimate user can answer correctly.

b. Authentication Protocols in Wireless Networks

• Protocols like EAP (Extensible Authentication Protocol) and RADIUS (Remote Authentication
Dial-In User Service) are designed to facilitate secure authentication in wireless
environments, ensuring that only authorized devices connect to the network.

c. Public Key Infrastructure (PKI)

• Involves a framework for managing digital certificates and public-key encryption, enabling
secure communication and authentication in distributed environments. PKI provides the
necessary trust model to ensure secure exchanges.

https://www.geeksforgeeks.org/hash-functions-system-security/

Designing a Hash Function Algorithm

A hash function algorithm is designed to take an input (or message) and produce a fixed-size string of
bytes, typically a digest that is unique to each unique input. The design of a hash function focuses on
several key principles and requirements to ensure its effectiveness in various applications, such as
data integrity verification, digital signatures, and password storage. Below are the essential elements
in designing a hash function, along with its features and properties.

1. Key Design Principles

1. Deterministic: The same input should always produce the same output. This is essential for
consistency in hash calculations.
2. Fixed Output Size: Regardless of the input size, the output (hash value) should have a
consistent length. Common hash functions like SHA-256 produce a 256-bit (32-byte) output.

3. Efficient Computation: The hash function should be computationally efficient, meaning it


should quickly produce the hash value for any given input.

4. Pre-image Resistance: Given a hash value, it should be computationally infeasible to find any
input that hashes to that value. This ensures the security of the hash function against reverse
engineering.

5. Second Pre-image Resistance: Given an input and its hash value, it should be
computationally infeasible to find another input that produces the same hash value. This
prevents collisions, where two different inputs yield the same hash.

6. Collision Resistance: It should be computationally infeasible to find two distinct inputs that
produce the same hash output. This property is crucial for maintaining the integrity of data.

7. Avalanche Effect: A small change in the input (even a single bit) should produce a
significantly different hash output. This property ensures that similar inputs do not yield
similar hashes.

8. Uniform Distribution: Hash outputs should be uniformly distributed across the output space,
minimizing the chances of collisions and ensuring that the hash values are randomly spread.

2. Features of Hash Functions

• One-way Function: Hash functions are designed to be one-way, meaning that once data is
transformed into a hash value, it should not be easily reversible.

• Speed: Hash functions should be fast to compute, making them suitable for various
applications, including checksums, data retrieval, and cryptographic operations.

• Compact Representation: They provide a compact representation of the input data, which is
useful for data storage and transmission.

• Resistance to Length Extension: Modern hash functions (like SHA-256) are designed to resist
length extension attacks, ensuring that appending additional data does not compromise the
security of the hash.

3. Properties of Hash Functions

1. Determinism: As mentioned earlier, for any given input, the output must be consistent every
time it is computed.

2. Compression: Hash functions compress input data of arbitrary size into a fixed-size hash
output. This makes it easier to handle large datasets.

3. Collision Resistance: This property ensures that it is difficult to find two different inputs that
hash to the same output. While not impossible (due to the pigeonhole principle), good hash
functions make finding such collisions computationally infeasible.

4. Pre-image and Second Pre-image Resistance: These properties safeguard against attempts
to reverse-engineer the input from its hash or find an alternative input with the same hash.
5. Avalanche Effect: The output should change dramatically with even the slightest change in
input, making it difficult to predict the output.

4. Examples of Hash Functions

• MD5 (Message Digest Algorithm 5): Produces a 128-bit hash value. While it is fast and
widely used, it is no longer considered secure due to vulnerabilities and collision attacks.

• SHA-1 (Secure Hash Algorithm 1): Produces a 160-bit hash value. SHA-1 has been
deprecated for many applications due to security flaws that make it vulnerable to collision
attacks.

• SHA-2: A family of hash functions that includes SHA-224, SHA-256, SHA-384, and SHA-512.
SHA-256 is widely used in security protocols and is considered secure.

• SHA-3: The latest member of the Secure Hash Algorithm family, which uses a different
underlying structure (Keccak) and offers enhanced security.

Illustrate the steps involved in Signature generation and Verification functions of DSS.

The Digital Signature Standard (DSS) is a widely used method for creating digital signatures to ensure
the authenticity and integrity of messages. It relies on asymmetric cryptography, where a private key
is used for signing, and a public key is used for verification. The most common algorithm used in DSS
is the Digital Signature Algorithm (DSA). Below are the detailed steps involved in signature
generation and verification functions of DSS.

Steps Involved in Signature Generation

1. Key Generation

o Select Parameters: Choose a large prime number ppp and a prime divisor qqq of
p−1p-1p−1. The number qqq typically has 160 bits.

o Choose a Base: Select a generator ggg of the subgroup of order qqq in


Zp∗\mathbb{Z}_p^*Zp∗.

o Generate Private Key: Randomly select a private key xxx such that 0<x<q0 < x <
q0<x<q.

o Compute Public Key: Compute the public key yyy using the formula: y=gxmod py =
g^x \mod py=gxmodp

2. Message Hashing

o Hash the Message: Use a cryptographic hash function (like SHA-256) to compute the
hash of the message MMM: H(M)=hH(M) = hH(M)=h

o The hash value hhh is a fixed-size representation of the message.

3. Signature Generation

o Select Random Integer: Choose a random integer kkk such that 0<k<q0 < k <
q0<k<q. This value must be kept secret and should not be reused.

o Compute Signature Components:

1. Calculate rrr: r=(gkmod p)mod qr = (g^k \mod p) \mod qr=(gkmodp)modq


2. Calculate the modular inverse of kkk modulo qqq: k−1mod qk^{-1} \mod
qk−1modq

3. Calculate sss: s=(k−1(h+x⋅r))mod qs = (k^{-1}(h + x \cdot r)) \mod


qs=(k−1(h+x⋅r))modq

o Generate the Signature: The digital signature (r,s)(r, s)(r,s) is the pair of values
calculated above.

Steps Involved in Signature Verification

1. Obtain Signature and Message

o The verifier receives the original message MMM and the digital signature (r,s)(r,
s)(r,s).

2. Hash the Message

o Compute the hash of the received message: H(M)=hH(M) = hH(M)=h

3. Signature Validation

o Check Signature Validity: Verify that rrr and sss are in the valid range, i.e., 0<r<q0 < r
< q0<r<q and 0<s<q0 < s < q0<s<q.

o Compute the Modular Inverse: Calculate the modular inverse of sss modulo qqq:
s−1mod qs^{-1} \mod qs−1modq

o Calculate the Values:

1. Compute u1u_1u1: u1=(h⋅s−1)mod qu_1 = (h \cdot s^{-1}) \mod qu1


=(h⋅s−1)modq

2. Compute u2u_2u2: u2=(r⋅s−1)mod qu_2 = (r \cdot s^{-1}) \mod qu2


=(r⋅s−1)modq

o Calculate vvv:

▪ Compute: v=((gu1⋅yu2)mod p)mod qv = ((g^{u_1} \cdot y^{u_2}) \mod p)


\mod qv=((gu1⋅yu2)modp)modq

4. Compare Values

o The signature is valid if and only if: v≡rmod qv \equiv r \mod qv≡rmodq

o If vvv equals rrr, the signature is valid, confirming that the message was not altered
and was signed by the holder of the private key.

Summary

The steps involved in the signature generation and verification functions of DSS demonstrate how
digital signatures ensure message authenticity and integrity through the use of asymmetric
cryptography. The process includes key generation, message hashing, signature creation, and
verification, highlighting the mathematical operations that provide security and reliability in digital
communications.

https://www.geeksforgeeks.org/digital-signature-standard-dss/
Illustrate the approaches for Digital signature.

Digital signatures provide a means of ensuring the authenticity and integrity of digital messages or
documents. They rely on cryptographic techniques, specifically asymmetric cryptography, to validate
the identities of the signers and verify that the content has not been altered. There are several
approaches to implementing digital signatures, each with its unique methods and algorithms. Below
are the key approaches to digital signatures:

1. Public Key Infrastructure (PKI) Approach

Description: PKI is a framework that uses asymmetric cryptography for creating digital signatures and
managing keys. It involves a trusted third party called a Certificate Authority (CA) that issues digital
certificates to users.

• Components:

o Public and Private Keys: Each user has a pair of keys. The private key is used to sign
the document, while the public key is used to verify the signature.

o Certificate Authority (CA): The CA issues digital certificates that bind the public keys
to user identities, ensuring trust.

• Process:

1. The signer generates a key pair and obtains a digital certificate from the CA.

2. The signer uses the private key to create a signature on the message.

3. The recipient uses the public key from the signer’s certificate to verify the signature.

• Example: Commonly used in secure web communications (HTTPS), email signing (S/MIME),
and document signing (PDF signing).

2. Hash-Based Digital Signature Approach

Description: This approach combines a cryptographic hash function with asymmetric encryption to
create a digital signature. The hash of the message is signed rather than the message itself.

• Components:

o Cryptographic Hash Function: A function that converts an input (or message) into a
fixed-size string of bytes. Common examples include SHA-256 and SHA-3.

o Signature Generation and Verification: Utilizes a signing algorithm to produce a


signature based on the hash value.

• Process:

1. The signer computes the hash of the message.

2. The hash is encrypted using the signer’s private key to create the digital signature.

3. The recipient computes the hash of the received message and decrypts the signature with
the signer’s public key.

4. If the hashes match, the signature is valid.


• Example: Used in many protocols, including TLS/SSL for secure web transactions and in
blockchain technologies.

3. Homomorphic Signature Approach

Description: This approach allows specific computations to be performed on the signed data without
requiring access to the private key. Homomorphic signatures enable verifying computations on
encrypted data.

• Components:

o Homomorphic Encryption: An encryption scheme that permits computations on


ciphertexts, resulting in an encrypted result that, when decrypted, matches the
result of operations performed on the plaintext.

o Signature Scheme: The digital signature is generated in such a way that it can be
verified even after computations have been performed on the signed data.

• Process:

1. The signer generates a signature on the data.

2. The data can be manipulated while still being encrypted, and a new signature can be
generated for the results without needing the private key.

3. Verification of the resulting signature is possible without revealing the original data or keys.

• Example: Useful in cloud computing environments where data privacy must be maintained
while performing operations on that data.

4. Threshold Signature Scheme

Description: This scheme allows a group of users to jointly create a digital signature such that a
predefined threshold of participants is required to generate the signature.

• Components:

o Share Generation: Each participant generates a share of the private key.

o Threshold Scheme: A minimum number of shares are needed to create a valid


signature.

• Process:

1. Each participant generates their part of the private key and keeps it secret.

2. To sign a message, the required number of participants collaborates to produce a signature.

3. The resulting signature can be verified with the public key derived from the combined public
shares.

• Example: Used in situations where enhanced security is needed, such as in decentralized


systems or multi-signature wallets in cryptocurrencies.

5. Post-Quantum Digital Signature Approach


Description: With the advancement of quantum computing, traditional digital signature algorithms
(like RSA and DSA) may become vulnerable. Post-quantum signatures are designed to withstand
quantum attacks.

• Components:

o Lattice-Based Cryptography: One of the leading candidates for post-quantum


signature schemes, based on the hardness of lattice problems.

o Hash-Based Signatures: Utilizes hash functions to create secure signatures resistant


to quantum attacks.

• Process:

1. Generate key pairs using post-quantum algorithms.

2. Create a signature using the secure scheme.

3. Verify the signature using the associated public key.

• Example: Ongoing research and standardization efforts are focused on developing post-
quantum digital signature algorithms to replace vulnerable systems.

• 16) Class of Message Authentication Functions

• Message authentication functions are vital cryptographic techniques that ensure the
integrity and authenticity of a message by verifying that the data has not been altered and
comes from a legitimate sender. These functions are widely used in communication
protocols, digital transactions, and secure data transmissions to protect against
unauthorized tampering or forgery.

• There are three main classes of message authentication functions:

• Hash Functions

• Message Authentication Code (MAC)

• Digital Signatures


• 1. Hash Functions

• A hash function is a one-way cryptographic function that converts an arbitrary-length input


(message) into a fixed-length hash value (digest). The main objective of a hash function is
to ensure data integrity.

• Key Characteristics:

• Deterministic: For a given input, the hash function will always produce the same output.

• Fixed Output Size: Regardless of the input size, the output length (digest) is fixed (e.g., 128
bits, 256 bits).

• Efficient Computation: Hashing must be fast and easy to compute.

• Preimage Resistance: It should be computationally infeasible to retrieve the original


message from the hash.
• Second Preimage Resistance: It should be hard to find a different message that produces
the same hash.

• Collision Resistance: It should be hard to find two different inputs that produce the same
hash.

• Common Examples:

• SHA-256 (Secure Hash Algorithm): Produces a 256-bit hash output.

• MD5 (Message Digest Algorithm 5): Produces a 128-bit hash, but is no longer considered
secure.

• Hash functions are used in applications like checksums, data integrity verification, and
digital signatures.


• 2. Message Authentication Code (MAC)

• A Message Authentication Code (MAC) is a cryptographic function that combines a secret


key with the message to produce a fixed-size output. This output (the MAC) verifies both
message integrity and authenticity because the key is shared between the sender and
receiver.

• Working:

• Sender: Computes the MAC of the message using a shared secret key and sends both the
message and the MAC to the receiver.

• Receiver: Uses the same shared key to generate the MAC from the received message and
compares it to the transmitted MAC.

• If the MACs match, the message is authentic and unaltered. If they don't, the message may
have been tampered with.

• Types of MACs:

• HMAC (Hash-based Message Authentication Code): Uses a hash function (e.g., SHA-256) in
combination with a secret key. HMAC provides strong security properties and is resistant to
certain cryptographic attacks.

• CBC-MAC (Cipher Block Chaining MAC): Uses a block cipher (e.g., AES) in Cipher Block
Chaining (CBC) mode to generate the MAC.

• Example:

• HMAC-SHA256: Uses the SHA-256 hash algorithm to compute the MAC based on a secret
key and the message.

• MACs are used in authentication protocols, secure file transfers, banking transactions, and
VPNs.


• 3. Digital Signatures
• A Digital Signature is a cryptographic function that verifies the authenticity and integrity of
a message using asymmetric (public-key) cryptography. Unlike MACs, which use a shared
secret key, digital signatures use a pair of keys (public and private keys) to achieve non-
repudiation—the sender cannot deny having sent the message.

• Working:

• Signing: The sender generates a signature using their private key and the message (usually
by first hashing the message and then encrypting the hash with the private key).

• Verification: The receiver verifies the signature using the sender's public key. If the
signature is valid, the message is authentic and unaltered.

• Steps:

• The sender hashes the message using a cryptographic hash function.

• The hash is encrypted with the sender's private key to form the signature.

• The message and the signature are sent to the receiver.

• The receiver decrypts the signature using the sender's public key to retrieve the hash.

• The receiver hashes the received message and compares the two hashes. If they match,
the signature is valid.

• Common Algorithms:

• RSA Digital Signature Algorithm: Based on the RSA encryption algorithm.

• DSA (Digital Signature Algorithm): A federal standard for digital signatures.

• Digital signatures are widely used in secure email (PGP), digital certificates (SSL/TLS),
electronic voting, and blockchain technology.


• Comparison of Message Authentication Functions

• Hash
• Feature • MAC • Digital Signature
Function

• Uses
• No secret • Requires a shared
• Key Usage public/private key
key secret key
pair

• Not • Provided by the • Provided by the


• Confidentiality
provided secret key private key

• Integrity • Yes • Yes • Yes

• Yes (because of • Yes (because of


• Authenticity • No
secret key) digital signing)
• Hash
• Feature • MAC • Digital Signature
Function

• Non-
• No • No • Yes
repudiation

• Data • Signing legal


• Secure message
• Application integrity, documents,
communication
checksums certificates

• Moderate
(asymmetric
• Efficiency • High • High
encryption is
slower)

Partc unit4:

1)

Here’s a detailed explanation of the SHA-512 algorithm, including its design, steps, features,
properties, and a diagram, suitable for a 20-mark question.

SHA-512 Overview

SHA-512 (Secure Hash Algorithm 512-bit) is part of the SHA-2 family designed by the National
Security Agency (NSA). It is a cryptographic hash function that produces a 512-bit (64-byte) hash
value from an input message of arbitrary length, providing integrity and authenticity for data.

Key Characteristics of SHA-512

• Output Length: Produces a fixed 512-bit message digest.


• Input Length: Can process messages of up to 21282^{128}2128 bits.

• Structure: Uses a Merkle-Damgård structure, which processes the input in blocks.

• Security Level: Designed to be secure against preimage attacks, second preimage attacks,
and collision attacks.

Steps Involved in the SHA-512 Algorithm

1. Preprocessing

1. Padding the Message:

o The original message is padded to ensure its length is 896mod 1024896 \mod
1024896mod1024.

o Padding is done by appending a single '1' bit followed by enough '0' bits so that the
total length is 896896896 bits before the length encoding.

o Finally, append a 128-bit representation of the original message length.

Example: For a message of length 448 bits, the padded message would be:

Message∥1∥zeros∥Length\text{Message} \quad \| \quad 1 \quad \| \quad \text{zeros} \quad \|


\quad \text{Length}Message∥1∥zeros∥Length

2. Initialization:

o Initialize eight hash values (H) using the first 64 bits of the fractional parts of the
square roots of the first 80 prime numbers.

H0=0x6a09e667f3bcc908,H1=0xbb67ae8584caa73b,H2=0x3c6ef372fe94f82b,H3=0xa54ff53a5f1d36f
1,H_0 = 0x6a09e667f3bcc908, H_1 = 0xbb67ae8584caa73b, H_2 = 0x3c6ef372fe94f82b, H_3 =
0xa54ff53a5f1d36f1,H0=0x6a09e667f3bcc908,H1=0xbb67ae8584caa73b,H2
=0x3c6ef372fe94f82b,H3=0xa54ff53a5f1d36f1,
H4=0x510e527fade682d1,H5=0x9b05688c2b3e6c1f,H6=0x1f83d9abfb41bd6b,H7=0x5be0cd19137e2
179H_4 = 0x510e527fade682d1, H_5 = 0x9b05688c2b3e6c1f, H_6 = 0x1f83d9abfb41bd6b, H_7 =
0x5be0cd19137e2179H4=0x510e527fade682d1,H5=0x9b05688c2b3e6c1f,H6
=0x1f83d9abfb41bd6b,H7=0x5be0cd19137e2179

2. Processing the Message in 1024-bit Blocks

1. Message Block Division:

o The padded message is divided into 1024-bit blocks.

o Each block is further divided into 16 words of 64 bits each.

2. Message Schedule Generation:

o Extend the initial 16 words into 80 words:

Wt=σ1(Wt−2)+Wt−7+σ0(Wt−15)+Wt−16W_t = \sigma_1(W_{t-2}) + W_{t-7} + \sigma_0(W_{t-15}) +


W_{t-16}Wt=σ1(Wt−2)+Wt−7+σ0(Wt−15)+Wt−16
o Where:

▪ σ0\sigma_0σ0 and σ1\sigma_1σ1 are defined as:

σ0(x)=(x≫1)⊕(x≫8)⊕(x≫7)\sigma_0(x) = (x \gg 1) \oplus (x \gg 8) \oplus (x \gg 7)σ0


(x)=(x≫1)⊕(x≫8)⊕(x≫7) σ1(x)=(x≫19)⊕(x≫61)⊕(x≫6)\sigma_1(x) = (x \gg 19) \oplus (x \gg 61)
\oplus (x \gg 6)σ1(x)=(x≫19)⊕(x≫61)⊕(x≫6)

3. Compression Function

1. Initialize Variables:

o Set a,b,c,d,e,f,g,ha, b, c, d, e, f, g, ha,b,c,d,e,f,g,h to the current hash values


H0,H1,H2,H3,H4,H5,H6,H7H_0, H_1, H_2, H_3, H_4, H_5, H_6, H_7H0,H1,H2,H3,H4
,H5,H6,H7.

2. Main Loop:

o For each of the 80 rounds:

▪ Calculate the message schedule and constants.

▪ Update variables using bitwise operations:

T1=h+Σ1(e)+Ch(e,f,g)+Kt+WtT1 = h + \Sigma_1(e) + Ch(e, f, g) + K_t + W_tT1=h+Σ1(e)+Ch(e,f,g)+Kt


+Wt T2=Σ0(a)+Maj(a,b,c)T2 = \Sigma_0(a) + Maj(a, b, c)T2=Σ0(a)+Maj(a,b,c)
h=g,g=f,f=e,e=d+T1,d=c,c=b,b=a,a=T1+T2h = g, g = f, f = e, e = d + T1, d = c, c = b, b = a, a = T1 +
T2h=g,g=f,f=e,e=d+T1,d=c,c=b,b=a,a=T1+T2

o Where KtK_tKt are constants derived from the first 64 prime numbers and ChChCh
and MajMajMaj are:

Ch(x,y,z)=(x∧y)⊕(¬x∧z)Ch(x, y, z) = (x \land y) \oplus (\neg x \land z)Ch(x,y,z)=(x∧y)⊕(¬x∧z)


Maj(x,y,z)=(x∧y)⊕(x∧z)⊕(y∧z)Maj(x, y, z) = (x \land y) \oplus (x \land z) \oplus (y \land
z)Maj(x,y,z)=(x∧y)⊕(x∧z)⊕(y∧z)

4. Update Hash Values

• After processing all blocks, update the hash values:

Hi=Hi+a(i=0 to 7)H_i = H_i + a \quad (i=0 \text{ to } 7)Hi=Hi+a(i=0 to 7)

5. Output the Final Hash Value

• Concatenate the final hash values to produce the 512-bit message digest:

Digest=H0∥H1∥H2∥H3∥H4∥H5∥H6∥H7\text{Digest} = H_0 \| H_1 \| H_2 \| H_3 \| H_4 \| H_5 \| H_6


\| H_7Digest=H0∥H1∥H2∥H3∥H4∥H5∥H6∥H7

Diagram of SHA-512 Algorithm

Below is a detailed diagram illustrating the main components and steps of the SHA-512 algorithm:
plaintext

Copy code

+-------------------------------+

| Input Message |

+-------------------------------+

+-------------------------------+

| Preprocessing |

| (Padding and Length) |

+-------------------------------+

+-------------------------------+

| Initialize Hash Values (H) |

+-------------------------------+

+-------------------------------+

| Process in 1024-bit Blocks |

| (Divide and Extend Words) |

+-------------------------------+

+-------------------------------+

| Message Schedule |

| (Extend to 80 words) |

+-------------------------------+

+-------------------------------+
| Compression Function |

| (80 Rounds) |

| (Update Hash Values) |

+-------------------------------+

+-------------------------------+

| Output Final Digest |

| (512-bit Hash) |

+-------------------------------+

Features of SHA-512

1. Collision Resistance: It is computationally infeasible to find two different inputs that produce
the same hash output.

2. Preimage Resistance: Given a hash output, it should be hard to find an input that hashes to
that output.

3. Second Preimage Resistance: Given an input and its hash output, it should be hard to find a
different input that produces the same hash output.

4. Efficiency: SHA-512 is efficient in software and hardware implementations.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy