How to use hash values( Cryptography)

profilemadhu_ladu10
Ch11Crypto7e_accessiblePPT.pptx

Cryptography and Network Security: Principles and Practice

Seventh Edition

Chapter 11

Cryptographic Hash Functions

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

If this PowerPoint presentation contains mathematical equations, you may need to check that your computer has the following installed:

1) MathType Plugin

2) Math Player (free versions available)

3) NVDA Reader (free versions available)

Lecture slides prepared for “Cryptography and Network Security”, 7/e, by William Stallings, Chapter 11 – “Cryptographic Hash Functions”.

This chapter begins with a discussion of the wide variety of applications for

cryptographic hash functions. Next, we look at the security requirements for such

functions. Then we look at the use of cipher block chaining to implement a cryptographic

hash function. The remainder of the chapter is devoted to the most important

and widely used family of cryptographic hash functions, the Secure Hash Algorithm

(SHA) family.

Hash Functions

A hash function H accepts a variable-length block of data M as input and produces a fixed-size hash value

Principal object is data integrity

Cryptographic hash function

An algorithm for which it is computationally infeasible to find either:

(a) a data object that maps to a pre-specified hash result (the one-way property)

(b) two data objects that map to the same hash result (the collision-free property)

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

A hash function H accepts a variable-length block of data M as input and produces

a fixed-size hash value h = H(M ). A “good” hash function has the property that the

results of applying the function to a large set of inputs will produce outputs that are

evenly distributed and apparently random. In general terms, the principal object of a

hash function is data integrity. A change to any bit or bits in M results, with high probability,

in a change to the hash code.

The kind of hash function needed for security applications is referred to as a

cryptographic hash function . A cryptographic hash function is an algorithm for which

it is computationally infeasible (because no attack is significantly more efficient than

brute force) to find either (a) a data object that maps to a pre-specified hash result

(the one-way property) or (b) two data objects that map to the same hash result (the

collision-free property). Because of these characteristics, hash functions are often used

to determine whether or not data has changed.

2

Figure 11.1 Cryptographic Hash Function h = uppercase h left parenthesis m right parenthesis

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

Figure 11.1 depicts the general operation of a cryptographic hash function.

Typically, the input is padded out to an integer multiple of some fixed length

(e.g., 1024 bits), and the padding includes the value of the length of the original message

in bits. The length field is a security measure to increase the difficulty for an

attacker to produce an alternative message with the same hash value.

3

Figure 11.2 Attack Against Hash Function

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

4

Message authentication is a mechanism or service used to verify the integrity of

a message. Message authentication assures that data received are exactly as sent

(i.e., contain no modification, insertion, deletion, or replay). In many cases, there is

a requirement that the authentication mechanism assures that purported identity of

the sender is valid. When a hash function is used to provide message authentication,

the hash function value is often referred to as a message digest .

The essence of the use of a hash function for message authentication is as

follows. The sender computes a hash value as a function of the bits in the message

and transmits both the hash value and the message. The receiver performs the same

hash calculation on the message bits and compares this value with the incoming

hash value. If there is a mismatch, the receiver knows that the message (or possibly

the hash value) has been altered (Figure 11.2a).

The hash function must be transmitted in a secure fashion. That is, the hash

function must be protected so that if an adversary alters or replaces the message,

it is not feasible for adversary to also alter the hash value to fool the receiver. This

type of attack is shown in Figure 11.2b. In this example, Alice transmits a data block

and attaches a hash value. Darth intercepts the message, alters or replaces the data

block, and calculates and attaches a new hash value. Bob receives the altered data

with the new hash value and does not detect the change. To prevent this attack, the

hash value generated by Alice must be protected.

Figure 11.3 Simplified Examples of the Use of a Hash Function for Message Authentication

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

5

Figure 11.3 illustrates a variety of ways in which a hash code can be used to

provide message authentication, as follows:

a. The message plus concatenated hash code is encrypted using symmetric

encryption. Because only A and B share the secret key, the message must

have come from A and has not been altered. The hash code provides the structure

or redundancy required to achieve authentication. Because encryption is

applied to the entire message plus hash code, confidentiality is also provided.

b. Only the hash code is encrypted, using symmetric encryption. This reduces the

processing burden for those applications that do not require confidentiality.

c. It is possible to use a hash function but no encryption for message authentication.

The technique assumes that the two communicating parties share a common secret

value S. A computes the hash value over the concatenation of M and S and

appends the resulting hash value to M. Because B possesses S, it can recompute

the hash value to verify. Because the secret value itself is not sent, an opponent

cannot modify an intercepted message and cannot generate a false message.

d. Confidentiality can be added to the approach of method (c) by encrypting the

entire message plus the hash code.

When confidentiality is not required, method (b) has an advantage over

methods (a) and (d), which encrypts the entire message, in that less computation

is required. Nevertheless, there has been growing interest in techniques that

avoid encryption (Figure 11.3c). Several reasons for this interest are pointed out in

[TSUD92].

• Encryption software is relatively slow. Even though the amount of data to be

encrypted per message is small, there may be a steady stream of messages into

and out of a system.

• Encryption hardware costs are not negligible. Low-cost chip implementations

of DES are available, but the cost adds up if all nodes in a network must have

this capability.

• Encryption hardware is optimized toward large data sizes. For small blocks

of data, a high proportion of the time is spent in initialization/invocation

overhead.

• Encryption algorithms may be covered by patents, and there is a cost associated

with licensing their use.

Message Authentication Code (M A C)

Also known as a keyed hash function

Typically used between two parties that share a secret key to authenticate information exchanged between those parties

Takes as input a secret key and a data block and produces a hash value (M A C) which is associated with the protected message

If the integrity of the message needs to be checked, the M A C function can be applied to the message and the result compared with the associated M A C value

An attacker who alters the message will be unable to alter the associated M A C value without knowledge of the secret key

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

More commonly, message authentication is achieved using a message authentication

code (MAC ), also known as a keyed hash function . Typically, MACs are

used between two parties that share a secret key to authenticate information exchanged

between those parties. A MAC function takes as input a secret key and a

data block and produces a hash value, referred to as the MAC, which is associated

with the protected message. If the integrity of the message needs to be checked, the

MAC function can be applied to the message and the result compared with the associated

MAC value. An attacker who alters the message will be unable to alter the

associated MAC value without knowledge of the secret key. Note that the verifying

party also knows who the sending party is because no one else knows the secret key.

Note that the combination of hashing and encryption results in an overall

function that is, in fact, a MAC (Figure 11.3b). That is, E(K , H(M )) is a function of

a variable-length message M and a secret key K , and it produces a fixed-size output

that is secure against an opponent who does not know the secret key. In practice,

specific MAC algorithms are designed that are generally more efficient than an encryption

algorithm.

6

Digital Signature

Operation is similar to that of the M A C

The hash value of a message is encrypted with a user’s private key

Anyone who knows the user’s public key can verify the integrity of the message

An attacker who wishes to alter the message would need to know the user’s private key

Implications of digital signatures go beyond just message authentication

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

Another important application, which is similar to the message authentication

Application, is the digital signature . The operation of the digital signature is similar

to that of the MAC. In the case of the digital signature, the hash value of a message

is encrypted with a user’s private key. Anyone who knows the user’s public key

can verify the integrity of the message that is associated with the digital signature.

In this case, an attacker who wishes to alter the message would need to know the

user’s private key. As we shall see in Chapter 14, the implications of digital signatures

go beyond just message authentication.

7

Figure 11.4 Simplified Examples of Digital Signatures

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

Figure 11.4 illustrates, in a simplified fashion, how a hash code is used to provide

a digital signature.

a. The hash code is encrypted, using public-key encryption with the sender’s private

key. As with Figure 11.3b, this provides authentication. It also provides a

digital signature, because only the sender could have produced the encrypted

hash code. In fact, this is the essence of the digital signature technique.

b. If confidentiality as well as a digital signature is desired, then the message

plus the private-key-encrypted hash code can be encrypted using a symmetric

secret key. This is a common technique.

8

Other Hash Function Uses (1 of 2)

Commonly used to create a one-way password file

When a user enters a password, the hash of that password is compared to the stored hash value for verification

This approach to password protection is used by most operating systems

Can be used for intrusion and virus detection

Store

for each file on a system and secure the hash values

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

Hash functions are commonly used to create a one-way password file . Chapter 21

explains a scheme in which a hash of a password is stored by an operating system

rather than the password itself. Thus, the actual password is not retrievable by

a hacker who gains access to the password file. In simple terms, when a user enters

a password, the hash of that password is compared to the stored hash value

for verification. This approach to password protection is used by most operating

systems.

Hash functions can be used for intrusion detection and virus detection . Store

H(F) for each file on a system and secure the hash values (e.g., on a CD-R that is

kept secure). One can later determine if a file has been modified by recomputing

H(F). An intruder would need to change F without changing H(F).

A cryptographic hash function can be used to construct a pseudorandom

function (PRF) or a pseudorandom number generator (PRNG) . A common application

for a hash-based PRF is for the generation of symmetric keys. We discuss this

application in Chapter 12.

9

Other Hash Function Uses (2 of 2)

One can later determine if a file has been modified by re

recomputing

An intruder would need to change F without changing

Can be used to construct a pseudorandom function (P R F) or a pseudorandom number generator (P R N G)

A common application for a hash-based P R F is for the generation of symmetric keys

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

Hash functions are commonly used to create a one-way password file . Chapter 21

explains a scheme in which a hash of a password is stored by an operating system

rather than the password itself. Thus, the actual password is not retrievable by

a hacker who gains access to the password file. In simple terms, when a user enters

a password, the hash of that password is compared to the stored hash value

for verification. This approach to password protection is used by most operating

systems.

Hash functions can be used for intrusion detection and virus detection . Store

H(F) for each file on a system and secure the hash values (e.g., on a CD-R that is

kept secure). One can later determine if a file has been modified by recomputing

H(F). An intruder would need to change F without changing H(F).

A cryptographic hash function can be used to construct a pseudorandom

function (PRF) or a pseudorandom number generator (PRNG) . A common application

for a hash-based PRF is for the generation of symmetric keys. We discuss this

application in Chapter 12.

10

Two Simple Hash Functions (1 of 2)

Consider two simple insecure hash functions that operate using the following general principles:

The input is viewed as a sequence of n-bit blocks

The input is processed one block at a time in an iterative fashion to produce an n-bit hash function

Bit-by-bit exclusive-OR (XOR) of every block

Produces a simple parity for each bit position and is known as a longitudinal redundancy check

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

To get some feel for the security considerations involved in cryptographic hash functions, we present two simple, insecure hash functions in this section. One of the simplest hash functions is the bit-by-bit exclusive-OR (XOR) of every block, which can be expressed as shown. This operation produces a simple parity for each bit position and is known as a longitudinal redundancy check. It is reasonably effective for random data as a data integrity check. Each n-bit hash value is equally likely. Thus, the probability that a data error will result in an unchanged hash value is 2–n. With more predictably formatted data, the function is less effective. For example, in most normal text files, the high-order bit of each octet is always zero. So if a 128-bit hash value is used, instead of an effectiveness of 2–128, the hash function on this type of data has an effectiveness of 2–112.

A simple way to improve matters is to perform a one-bit circular shift, or rotation, on the hash value after each block is processed. Although this second procedure provides a good measure of data integrity, it is virtually useless for data security when an encrypted hash code is used with a plaintext message. Given a message, it is an easy matter to produce a new message that yields that hash code: Simply prepare the desired alternate message and then append an n-bit block that forces the new message plus block to yield the desired hash code.

11

Two Simple Hash Functions (2 of 2)

Reasonably effective for random data as a data integrity check

Perform a one-bit circular shift on the hash value after each block is processed

Has the effect of randomizing the input more completely and overcoming any regularities that appear in the input

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

To get some feel for the security considerations involved in cryptographic hash functions, we present two simple, insecure hash functions in this section. One of the simplest hash functions is the bit-by-bit exclusive-OR (XOR) of every block, which can be expressed as shown. This operation produces a simple parity for each bit position and is known as a longitudinal redundancy check. It is reasonably effective for random data as a data integrity check. Each n-bit hash value is equally likely. Thus, the probability that a data error will result in an unchanged hash value is 2–n. With more predictably formatted data, the function is less effective. For example, in most normal text files, the high-order bit of each octet is always zero. So if a 128-bit hash value is used, instead of an effectiveness of 2–128, the hash function on this type of data has an effectiveness of 2–112.

A simple way to improve matters is to perform a one-bit circular shift, or rotation, on the hash value after each block is processed. Although this second procedure provides a good measure of data integrity, it is virtually useless for data security when an encrypted hash code is used with a plaintext message. Given a message, it is an easy matter to produce a new message that yields that hash code: Simply prepare the desired alternate message and then append an n-bit block that forces the new message plus block to yield the desired hash code.

12

Figure 11.5 Two Simple Hash Functions

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

Figure 11.5 illustrates these two types of hash functions for 16-bit hash values.

Although the second procedure provides a good measure of data integrity,

it is virtually useless for data security when an encrypted hash code is used with a

plaintext message, as in Figures 11.3b and 11.4a. Given a message, it is an easy matter

to produce a new message that yields that hash code: Simply prepare the desired

alternate message and then append an n -bit block that forces the new message plus

block to yield the desired hash code.

Although a simple XOR or rotated XOR (RXOR) is insufficient if only the

hash code is encrypted, you may still feel that such a simple function could be useful

when the message together with the hash code is encrypted (Figure 11.3a). But

you must be careful.

13

Requirements and Security

Preimage Collision
x is the preimage of h for a hash value Occurs if we have
Is a data block whose hash function, using the function H, is h Because we are using hash functions for data integrity, collisions are clearly undesirable
Because H is a many-to-one mapping, for any given hash value h, there will in general be multiple preimages

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

Before proceeding, we need to define two terms. For a hash value h = H(x ), we say

that x is the preimage of h . That is, x is a data block whose hash function, using the

function H, is h . Because H is a many-to-one mapping, for any given hash value h ,

there will in general be multiple preimages. A collision occurs if we have x ≠ y and

H(x ) = H(y ). Because we are using hash functions for data integrity, collisions are

clearly undesirable.

14

Table 11.1 Requirements for a Cryptographic Hash Function H

Requirement Description
Variable input size H can be applied to a block of data of any size.
Fixed output Size H produces a fixed-length output.
Efficiency is relatively easy to compute for any given x. making both hardware and software implementations practical.
Preimage resistant (one-way property) For any given hash value h. it is computationally infeasible to find y such that
Second preimage resistant (weak collision resistant) For any given block x, it is computationally infeasible to find
Collision resistant (strong collision resistant) It is computationally infeasible to find any pair
Pseudo randomness Output of H meets standard tests for Pseudo randomness

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

15

Table 11.1 lists the generally accepted requirements for a cryptographic hash function.

The first three properties are requirements for the practical application of a

hash function.

The fourth property, preimage resistant , is the one-way property: it is easy

to generate a code given a message, but virtually impossible to generate a message

given a code. This property is important if the authentication technique involves the

use of a secret value (Figure 11.3c). The secret value itself is not sent.

The fifth property, second preimage resistant , guarantees that it is impossible

to find an alternative message with the same hash value as a given message. This

prevents forgery when an encrypted hash code is used (Figures 11.3b and 11.4a). If

this property were not true, an attacker would be capable of the following sequence:

First, observe or intercept a message plus its encrypted hash code; second, generate

an unencrypted hash code from the message; third, generate an alternate message

with the same hash code.

A hash function that satisfies the first five properties in Table 11.1 is referred

to as a weak hash function. If the sixth property, collision resistant , is also satisfied,

then it is referred to as a strong hash function. A strong hash function protects

against an attack in which one party generates a message for another party to sign.

For example, suppose Bob writes an IOU message, sends it to Alice, and she signs

it. Bob finds two messages with the same hash, one of which requires Alice to pay a

small amount and one that requires a large payment. Alice signs the first message,

and Bob is then able to claim that the second message is authentic

The final requirement in Table 11.1, pseudorandomness , has not traditionally

been listed as a requirement of cryptographic hash functions but is more or less implied.

[JOHN05] points out that cryptographic hash functions are commonly used

for key derivation and pseudorandom number generation, and that in message integrity

applications, the three resistant properties depend on the output of the hash

function appearing to be random. Thus, it makes sense to verify that in fact a given

hash function produces pseudorandom output.

Figure 11.6 Relationship Among Hash Function Properties

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

Figure 11.6 shows the relationships among the three resistant properties.

A function that is collision resistant is also second preimage resistant, but the

reverse is not necessarily true. A function can be collision resistant but not preimage

resistant and vice versa. A function can be preimage resistant but not second

preimage resistant and vice versa. See [MENE97] for a discussion.

16

Table 11.2 Hash Function Resistance Properties Required for Various Data Integrity Applications

Blank Preimage Resistant Second Preimage Resistant Collision Resistant
Hash + digital Signature Yes Yes Yes*
Intrusion Detection and virus detection Blank Yes Blank
Hash + symmetric encryption Blank Blank Blank
One-way password file Yes Blank Blank
MAC Yes Yes Yes*

* Resistance required if attacker is able to mount a chosen message attack

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

Table 11.2 shows the resistant properties required for various hash function

applications.

17

Attacks on Hash Functions

Brute-Force Attacks Cryptanalysis
Does not depend on the specific algorithm, only depends on bit length An attack based on weaknesses in a particular cryptographic algorithm
In the case of a hash function, attack depends only on the bit length of the hash value Seek to exploit some property of the algorithm to perform some attack other than an exhaustive search
Method is to pick values at random and try each one until a collision occurs Blank

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

As with encryption algorithms, there are two categories of attacks on hash

functions: brute-force attacks and cryptanalysis. A brute-force attack does not depend

on the specific algorithm but depends only on bit length. In the case of a hash

function, a brute-force attack depends only on the bit length of the hash value. A

cryptanalysis, in contrast, is an attack based on weaknesses in a particular cryptographic

algorithm.

18

Collision Resistant Attacks (1 of 3)

For a collision resistant attack, an adversary wishes to find two messages or data blocks that yield the same hash function

The effort required is explained by a mathematical result referred to as the birthday paradox

Yuval proposed the following strategy to exploit the birthday paradox in a collision resistant attack:

The source (A) is prepared to sign a legitimate message x by appending the appropriate m-bit hash code and encrypting that hash code with A’s private key

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

19

For a collision resistant attack, an adversary wishes

to find two messages or data blocks, x and y , that yield the same hash function:

H(x) = H(y). This turns out to require considerably less effort than a preimage or

second preimage attack. The effort required is explained by a mathematical result

referred to as the birthday paradox. In essence, if we choose random variables from

a uniform distribution in the range 0 through N - 1, then the probability that a

repeated element is encountered exceeds 0.5 after √N choices have been made.

Thus, for an m-bit hash value, if we pick data blocks at random, we can expect to

find two data blocks with the same hash value within √2m = 2m/2 attempts. The

mathematical derivation of this result is found in Appendix U.

Yuval proposed the following strategy to exploit the birthday paradox in a

Collision resistant attack [YUVA79].

The source, A, is prepared to sign a legitimate message x by appending the appropriate m-bit hash code and encrypting that hash code with A’s private key (Figure 11.4a).

2. The opponent generates 2m/2 variations x’ of x, all of which convey essentially

the same meaning, and stores the messages and their hash values.

3. The opponent prepares a fraudulent message y for which A’s signature is

desired.

4. The opponent generates minor variations y’ of y, all of which convey essentially

the same meaning. For each y’, the opponent computes H(y’), checks

for matches with any of the H(x’) values, and continues until a match is found.

That is, the process continues until a y’ is generated with a hash value equal to

the hash value of one of the x’ values.

5. The opponent offers the valid variation to A for signature. This signature can

then be attached to the fraudulent variation for transmission to the intended

recipient. Because the two variations have the same hash code, they will produce

the same signature; the opponent is assured of success even though the

encryption key is not known.

Thus, if a 64-bit hash code is used, the level of effort required is only on the

order of 232 [see Appendix U, Equation (U.7)].

The generation of many variations that convey the same meaning is not difficult.

For example, the opponent could insert a number of “space-space-backspace”

character pairs between words throughout the document. Variations could then

be generated by substituting “space-backspace-space” in selected instances.

Alternatively, the opponent could simply reword the message but retain the

Meaning. Figure 11.7 provides an example.

To summarize, for a hash code of length m, the level of effort required, as we

have seen, is proportional to the following.

Preimage resistant 2m

Second preimage resistant 2m

Collision resistant 2m/2

Collision Resistant Attacks (2 of 3)

Opponent generates

all with

essentially the same meaning, and stores the messages and their hash values

Opponent prepares a fraudulent message y for which A’s signature is desired

Opponent generates minor variations

which convey essentially the same meaning. For

the opponent computes

matches with any of the

values, and continues

until a match is found. That is, the process continues

is generated with a hash value equal to the

hash value of one of the

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

20

For a collision resistant attack, an adversary wishes

to find two messages or data blocks, x and y , that yield the same hash function:

H(x) = H(y). This turns out to require considerably less effort than a preimage or

second preimage attack. The effort required is explained by a mathematical result

referred to as the birthday paradox. In essence, if we choose random variables from

a uniform distribution in the range 0 through N - 1, then the probability that a

repeated element is encountered exceeds 0.5 after √N choices have been made.

Thus, for an m-bit hash value, if we pick data blocks at random, we can expect to

find two data blocks with the same hash value within √2m = 2m/2 attempts. The

mathematical derivation of this result is found in Appendix U.

Yuval proposed the following strategy to exploit the birthday paradox in a

Collision resistant attack [YUVA79].

The source, A, is prepared to sign a legitimate message x by appending the appropriate m-bit hash code and encrypting that hash code with A’s private key (Figure 11.4a).

2. The opponent generates 2m/2 variations x’ of x, all of which convey essentially

the same meaning, and stores the messages and their hash values.

3. The opponent prepares a fraudulent message y for which A’s signature is

desired.

4. The opponent generates minor variations y’ of y, all of which convey essentially

the same meaning. For each y’, the opponent computes H(y’), checks

for matches with any of the H(x’) values, and continues until a match is found.

That is, the process continues until a y’ is generated with a hash value equal to

the hash value of one of the x’ values.

5. The opponent offers the valid variation to A for signature. This signature can

then be attached to the fraudulent variation for transmission to the intended

recipient. Because the two variations have the same hash code, they will produce

the same signature; the opponent is assured of success even though the

encryption key is not known.

Thus, if a 64-bit hash code is used, the level of effort required is only on the

order of 232 [see Appendix U, Equation (U.7)].

The generation of many variations that convey the same meaning is not difficult.

For example, the opponent could insert a number of “space-space-backspace”

character pairs between words throughout the document. Variations could then

be generated by substituting “space-backspace-space” in selected instances.

Alternatively, the opponent could simply reword the message but retain the

Meaning. Figure 11.7 provides an example.

To summarize, for a hash code of length m, the level of effort required, as we

have seen, is proportional to the following.

Preimage resistant 2m

Second preimage resistant 2m

Collision resistant 2m/2

Collision Resistant Attacks (3 of 3)

The opponent offers the valid variation to A for signature which can then be attached to the fraudulent variation for transmission to the intended recipient

Because the two variations have the same hash code, they will produce the same signature and the opponent is assured of success even though the encryption key is not known

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

21

For a collision resistant attack, an adversary wishes

to find two messages or data blocks, x and y , that yield the same hash function:

H(x) = H(y). This turns out to require considerably less effort than a preimage or

second preimage attack. The effort required is explained by a mathematical result

referred to as the birthday paradox. In essence, if we choose random variables from

a uniform distribution in the range 0 through N - 1, then the probability that a

repeated element is encountered exceeds 0.5 after √N choices have been made.

Thus, for an m-bit hash value, if we pick data blocks at random, we can expect to

find two data blocks with the same hash value within √2m = 2m/2 attempts. The

mathematical derivation of this result is found in Appendix U.

Yuval proposed the following strategy to exploit the birthday paradox in a

Collision resistant attack [YUVA79].

The source, A, is prepared to sign a legitimate message x by appending the appropriate m-bit hash code and encrypting that hash code with A’s private key (Figure 11.4a).

2. The opponent generates 2m/2 variations x’ of x, all of which convey essentially

the same meaning, and stores the messages and their hash values.

3. The opponent prepares a fraudulent message y for which A’s signature is

desired.

4. The opponent generates minor variations y’ of y, all of which convey essentially

the same meaning. For each y’, the opponent computes H(y’), checks

for matches with any of the H(x’) values, and continues until a match is found.

That is, the process continues until a y’ is generated with a hash value equal to

the hash value of one of the x’ values.

5. The opponent offers the valid variation to A for signature. This signature can

then be attached to the fraudulent variation for transmission to the intended

recipient. Because the two variations have the same hash code, they will produce

the same signature; the opponent is assured of success even though the

encryption key is not known.

Thus, if a 64-bit hash code is used, the level of effort required is only on the

order of 232 [see Appendix U, Equation (U.7)].

The generation of many variations that convey the same meaning is not difficult.

For example, the opponent could insert a number of “space-space-backspace”

character pairs between words throughout the document. Variations could then

be generated by substituting “space-backspace-space” in selected instances.

Alternatively, the opponent could simply reword the message but retain the

Meaning. Figure 11.7 provides an example.

To summarize, for a hash code of length m, the level of effort required, as we

have seen, is proportional to the following.

Preimage resistant 2m

Second preimage resistant 2m

Collision resistant 2m/2

Figure 11.7 A Letter in 2 to the twenty eighth power Variation

(Letter is located on page 334 in textbook)

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

If collision resistance is required (and this is desirable for a general-purpose

secure hash code), then the value 2m/2 determines the strength of the hash code

against brute-force attacks. Van Oorschot and Wiener [VANO94] presented

a design for a $10 million collision search machine for MD5, which has a 128-bit hash

length, that could find a collision in 24 days. Thus, a 128-bit code may be viewed as

inadequate. The next step up, if a hash code is treated as a sequence of 32 bits,

is a 160-bit hash length. With a hash length of 160 bits, the same search machine

would require over four thousand years to find a collision. With today’s technology,

the time would be much shorter, so that 160 bits now appears suspect.

22

Figure 11.8 General Structure of Secure Hash Code

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

In recent years, there has been considerable effort, and some successes,

in developing cryptanalytic attacks on hash functions. To understand these, we

need to look at the overall structure of a typical secure hash function, indicated in

Figure 11.8. This structure, referred to as an iterated hash function, was proposed

by Merkle [MERK79, MERK89] and is the structure of most hash functions in use

today, including SHA, which is discussed later in this chapter. The hash function

takes an input message and partitions it into L fixed-sized blocks of b bits each.

If necessary, the final block is padded to b bits. The final block also includes the

value of the total length of the input to the hash function. The inclusion of the

length makes the job of the opponent more difficult. Either the opponent must

find two messages of equal length that hash to the same value or two messages of

differing lengths that, together with their length values, hash to the same value.

The hash algorithm involves repeated use of a compression function, f, that

takes two inputs (an n-bit input from the previous step, called the chaining variable ,

and a b -bit block) and produces an n -bit output. At the start of hashing, the chaining

variable has an initial value that is specified as part of the algorithm. The final

value of the chaining variable is the hash value.

23

Hash Functions Based on Cipher Block Chaining (1 of 3)

A number of proposals have been made for hash functions based on using a cipher block chaining technique, but without using the secret key

One of the first proposals was that of Rabin

Divide a message M into fixed-size blocks

and use a symmetric encryption

system such as D E S to compute the hash code G as

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

A number of proposals have been made for hash functions based on using a cipher block chaining technique, but without the secret key (instead using the message blocks as keys). One of the first such proposals was that of Rabin, [RABI78]. Divide a message M into fixed-size blocks, and use a symmetric encryption system such as DES to compute the hash code G as shown. This is similar to the CBC technique, but in this case there is no secret key. As with any hash code, this scheme is subject to the birthday attack, and if the encryption algorithm is DES and only a 64-bit hash code is produced, then the system is vulnerable.

Furthermore, another version of the birthday attack can be used even if the opponent has access to only one message and its valid signature and cannot obtain multiple signings.

It can be shown that some form of birthday attack will succeed against any hash scheme involving the use of cipher block chaining without a secret key, provided that either the resulting hash code is small enough

(e.g., 64 bits or less) or that a larger hash code can be decomposed into independent subcodes [JUEN87].

Thus, attention has been directed at finding other approaches to hashing.

Many of these have also been shown to have weaknesses [MITC92].

24

Hash Functions Based on Cipher Block Chaining (2 of 3)

Similar to the C B C technique, but in this case, there is no secret key

As with any hash code, this scheme is subject to the birthday attack

If the encryption algorithm is D E S and only a 64-bit hash code is produced, the system is vulnerable

Meet-in-the-middle-attack

Another version of the birthday attack used even if the opponent has access to only one message and its valid signature and cannot obtain multiple signings

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

25

A number of proposals have been made for hash functions based on using a cipher block chaining technique, but without the secret key (instead using the message blocks as keys). One of the first such proposals was that of Rabin, [RABI78]. Divide a message M into fixed-size blocks, and use a symmetric encryption system such as DES to compute the hash code G as shown. This is similar to the CBC technique, but in this case there is no secret key. As with any hash code, this scheme is subject to the birthday attack, and if the encryption algorithm is DES and only a 64-bit hash code is produced, then the system is vulnerable.

Furthermore, another version of the birthday attack can be used even if the opponent has access to only one message and its valid signature and cannot obtain multiple signings.

It can be shown that some form of birthday attack will succeed against any hash scheme involving the use of cipher block chaining without a secret key, provided that either the resulting hash code is small enough

(e.g., 64 bits or less) or that a larger hash code can be decomposed into independent subcodes [JUEN87].

Thus, attention has been directed at finding other approaches to hashing.

Many of these have also been shown to have weaknesses [MITC92].

Hash Functions Based on Cipher Block Chaining (3 of 3)

It can be shown that some form of birthday attack will succeed against any hash scheme involving the use of cipher block chaining without a secret key, provided that either the resulting hash code is small enough or that a larger hash code can be decomposed into independent sub codes

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

26

A number of proposals have been made for hash functions based on using a cipher block chaining technique, but without the secret key (instead using the message blocks as keys). One of the first such proposals was that of Rabin, [RABI78]. Divide a message M into fixed-size blocks, and use a symmetric encryption system such as DES to compute the hash code G as shown. This is similar to the CBC technique, but in this case there is no secret key. As with any hash code, this scheme is subject to the birthday attack, and if the encryption algorithm is DES and only a 64-bit hash code is produced, then the system is vulnerable.

Furthermore, another version of the birthday attack can be used even if the opponent has access to only one message and its valid signature and cannot obtain multiple signings.

It can be shown that some form of birthday attack will succeed against any hash scheme involving the use of cipher block chaining without a secret key, provided that either the resulting hash code is small enough

(e.g., 64 bits or less) or that a larger hash code can be decomposed into independent subcodes [JUEN87].

Thus, attention has been directed at finding other approaches to hashing.

Many of these have also been shown to have weaknesses [MITC92].

Secure Hash Algorithm (S H A)

S H A was originally designed by the National Institute of Standards and Technology (N I S T) and published as a federal information processing standard (F I P S 180) in 1993

Was revised in 1995 as S H A-1

Based on the hash function M D 4 and its design closely models M D 4

Produces 160-bit hash values

In 2002 N I S T produced a revised version of the standard that defined three new versions of S H A with hash value lengths of 256, 384, and 512

Collectively known as S H A-2

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

27

In recent years, the most widely used hash function has been the Secure Hash

Algorithm (SHA). Indeed, because virtually every other widely used hash function

had been found to have substantial cryptanalytic weaknesses, SHA was more or

less the last remaining standardized hash algorithm by 2005. SHA was developed

by the National Institute of Standards and Technology (NIST) and published as a

federal information processing standard (FIPS 180) in 1993. When weaknesses were

discovered in SHA, now known as SHA-0, a revised version was issued as FIPS

180-1 in 1995 and is referred to as SHA-1. The actual standards document is entitled

“Secure Hash Standard.” SHA is based on the hash function MD4, and its design

closely models MD4.

SHA-1 produces a hash value of 160 bits. In 2002, NIST produced a revised

version of the standard, FIPS 180-2, that defined three new versions of SHA, with

hash value lengths of 256, 384, and 512 bits, known as SHA-256, SHA-384, and

SHA-512, respectively. Collectively, these hash algorithms are known as SHA-2 .

These new versions have the same underlying structure and use the same types of

modular arithmetic and logical binary operations as SHA-1.

Table 11.3 Comparison of S H A Parameters

Algorithm Message Size Block Size Word Size Message Digest Size
SHA-1 512 32 160
SHA-224 512 32 224
SHA-256 512 32 256
SHA-384 1024 64 384
SHA-512 1024 64 512
SHA-512/224 1024 64 224
SHA-512/256 1024 64 256

Note: All sizes are measured in bits.

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

A revised document was issued as FIP PUB 180-3 in 2008, which added a 224-bit version (Table 11.3).

In 2015, NIST issued FIPS 180-4, which added two additional algorithms:

SHA-512/224 and SHA-512/256. SHA-1 and SHA-2 are also specified in RFC

6234, which essentially duplicates the material in FIPS 180-3 but adds a C code

implementation.

In 2005, NIST announced the intention to phase out approval of SHA-1

and move to a reliance on SHA-2 by 2010. Shortly thereafter, a research team described

an attack in which two separate messages could be found that deliver the

same SHA-1 hash using 269 operations, far fewer than the 280 operations previously

thought needed to find a collision with an SHA-1 hash [WANG05]. This result

should hasten the transition to SHA-2.

28

Figure 11.9 Message Digest Generation Using S H A-512

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

29

The algorithm takes as input a message with a maximum length of less than 2128 bits

and produces as output a 512-bit message digest. The input is processed in 1024-bit

blocks. Figure 11.9 depicts the overall processing of a message to produce a digest.

This follows the general structure depicted in Figure 11.8. The processing consists

of the following steps.

Step 1 Append padding bits. The message is padded so that its length is congruent

to 896 modulo 1024 [length = 896(mod 1024)]. Padding is always added,

even if the message is already of the desired length. Thus, the number of

padding bits is in the range of 1 to 1024. The padding consists of a single 1

bit followed by the necessary number of 0 bits.

Step 2 Append length. A block of 128 bits is appended to the message. This block

is treated as an unsigned 128-bit integer (most significant byte first) and

contains the length of the original message (before the padding).

The outcome of the first two steps yields a message that is an integer

multiple of 1024 bits in length. In Figure 11.9, the expanded message is

represented as the sequence of 1024-bit blocks M1 , M2 , . . . , MN , so that the

total length of the expanded message is N * 1024 bits.

Step 3 Initialize hash buffer. A 512-bit buffer is used to hold intermediate

and final results of the hash function. The buffer can be represented as eight 64-bit

registers (a, b, c, d, e, f, g, h). These registers are initialized to the following

64-bit integers (hexadecimal values):

a = 6A09E667F3BCC908 e = 510E527FADE682D1

b = BB67AE8584CAA73B f = 9B05688C2B3E6C1F

c = 3C6EF372FE94F82B g = 1F83D9ABFB41BD6B

d = A54FF53A5F1D36F1 h = 5BE0CD19137E2179

These values are stored in big-endian format, which is the most significant

byte of a word in the low-address (leftmost) byte position. These words

were obtained by taking the first sixty-four bits of the fractional parts of the

square roots of the first eight prime numbers.

Step 4 Process message in 1024-bit (128-word) blocks. The heart of the algorithm

is a module that consists of 80 rounds; this module is labeled F in Figure 11.9.

The logic is illustrated in Figure 11.10.

Each round takes as input the 512-bit buffer value, abcdefgh, and

updates the contents of the buffer. At input to the first round, the buffer

has the value of the intermediate hash value, Hi-1 . Each round t makes

use of a 64-bit value Wt, derived from the current 1024-bit block being processed

(Mi ). These values are derived using a message schedule described

subsequently. Each round also makes use of an additive constant Kt , where

0 ≤ t ≤ 79 indicates one of the 80 rounds. These words represent the first

64 bits of the fractional parts of the cube roots of the first 80 prime numbers.

Step 5 Output. After all N 1024-bit blocks have been processed, the output from

the Nth stage is the 512-bit message digest.

Figure 11.10 S H A-512 Processing of a Single 1024-Bit Block

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

The heart of the algorithm is a module that consists of 80 rounds; this module is labeled F in Figure 11.9.

The logic is illustrated in Figure 11.10.

30

Table 11.4 S H A-512 Constants

(Table can be found on page 341 in textbook)

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

The constants provide a “randomized” set of 64-bit patterns, which should

eliminate any regularities in the input data. Table 11.4 shows these constants

in hexadecimal format (from left to right).

31

Figure 11.11 Elementary S H A-512 Operation (Single Round)

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

32

Let us look in more detail at the logic in each of the 80 steps of the processing

of one 512-bit block (Figure 11.11).

Figure 11.12 Creation of 80-Word Input Sequence for S H A-512 Processing of Single Block

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

Figure 11.12 Creation of 80-word Input Sequence for SHA-512 Processing of Single Block

33

Figure 11.13 S H A-512 Logic

(Figure can be found on page 345 in textbook)

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

Figure 11.13 summarizes the SHA-512 logic.

The SHA-512 algorithm has the property that every bit of the hash code is a

function of every bit of the input. The complex repetition of the basic function F

produces results that are well mixed; that is, it is unlikely that two messages chosen

at random, even if they exhibit similar regularities, will have the same hash code.

Unless there is some hidden weakness in SHA-512, which has not so far been published,

the difficulty of coming up with two messages having the same message digest

is on the order of 2256 operations, while the difficulty of finding a message with

a given digest is on the order of 2512 operations.

34

S H A-3

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

As of this writing, the Secure Hash Algorithm (SHA-1) has not yet been “broken.”

That is, no one has demonstrated a technique for producing collisions in a practical

amount of time. However, because SHA-1 is very similar, in structure and in the

basic mathematical operations used, to MD5 and SHA-0, both of which have been

broken, SHA-1 is considered insecure and has been phased out for SHA-2.

SHA-2, particularly the 512-bit version, would appear to provide unassailable

security. However, SHA-2 shares the same structure and mathematical operations

as its predecessors, and this is a cause for concern. Because it will take years to find

a suitable replacement for SHA-2, should it become vulnerable, NIST decided to

begin the process of developing a new hash standard.

Accordingly, NIST announced in 2007 a competition to produce the next generation

NIST hash function, to be called SHA-3. The winning design for SHA-3

was announced by NIST in October 2012. SHA-3 is a cryptographic hash function

that is intended to complement SHA-2 as the approved standard for a wide range

of applications.

Appendix V looks at the evaluation criteria used by NIST to select from

among the candidates for AES, plus the rationale for picking Keccak, which was

the winning candidate. This material is useful in understanding not just the SHA-3

design but also the criteria by which to judge any cryptographic hash algorithm.

35

The Sponge Construction

Underlying structure of S H A-3 is a scheme referred to by its designers as a sponge construction

Takes an input message and partitions it into fixed-size blocks

Each block is processed in turn with the output of each iteration fed into the next iteration, finally producing an output block

The sponge function is defined by three parameters:

f = the internal function used to process each input block

r = the size in bits of the input blocks, called the bitrate

pad = the padding algorithm

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

The underlying structure of SHA-3 is a scheme referred to by its designers as a

sponge construction [BERT07, BERT11]. The sponge construction has the same

general structure as other iterated hash functions (Figure 11.8). The sponge function

takes an input message and partitions it into fixed-size blocks. Each block is

processed in turn with the output of each iteration fed into the next iteration, finally

producing an output block.

The sponge function is defined by three parameters:

f = the internal function used to process each input block

r = the size in bits of the input blocks, called the bitrate

pad = the padding algorithm

36

Figure 11.14 Sponge Function Input and Output

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

A sponge function allows both variable length input and output, making it a

flexible structure that can be used for a hash function (fixed-length output), a pseudorandom

number generator (fixed-length input), and other cryptographic functions.

Figure 11.14 illustrates this point.

The sponge specification proposes [BERT11] proposes

two padding schemes:

• Simple padding: Denoted by pad10*, appends a single bit 1 followed by the

minimum number of bits 0 such that the length of the result is a multiple of the

block length.

• Multirate padding: Denoted by pad10*1, appends a single bit 1 followed by

the minimum number of bits 0 followed by a single bit 1 such that the length of

the result is a multiple of the block length. This is the simplest padding scheme

that allows secure use of the same f with different rates r . FIPS 202

uses multirate padding.

37

Figure 11.15 Sponge Construction

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

Figure 11.15 shows the iterated structure of the sponge function. The sponge

construction operates on a state variable s of b = r + c bits, which is initialized to all

zeros and modified at each iteration. The value r is called the bitrate. This value is

the block size used to partition the input message. The term bitrate reflects the fact

that r is the number of bits processed at each iteration: the larger the value of r, the

greater the rate at which message bits are processed by the sponge construction.

The value c is referred to as the capacity . A discussion of the security implications of

the capacity is beyond our scope. In essence, the capacity is a measure of the achievable

complexity of the sponge construction and therefore the achievable level of

security. A given implementation can trade claimed security for speed by increasing

the capacity c and decreasing the bitrate r accordingly, or vice versa. The default

values for Keccak are c = 1024 bits, r = 576 bits, and therefore b = 1600 bits.

38

Table 11.5 S H A-3 Parameters

Message Digest Size 224 256 384 512
Message Size No maximum No maximum No maximum No maximum
Block Size (bitrate r) 1152 1088 832 576
Word Size 64 64 64 64
Number of Rounds 24 24 24 24
Capacity c 448 512 768 1024
Collision Resistance
Second Preimage Resistance

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

Table 11.5 shows

the supported values of r and c. As Table 11.5 shows, the hash function security associated

with the sponge construction is a function of the capacity c .

39

Figure 11.16 S H A-3 State Matrix

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

We now examine the iteration function Keccak-f used to process each successive

block of the input message. Recall that f takes as input a 1600-bit variable s consisting

of r bits, corresponding to the message block size followed by c bits, referred to as the

capacity. For internal processing within f , the input state variable s is organized as a

5 * 5 * 64 array a. The 64-bit units are referred to as lanes. For our purposes, we generally

use the notation a [x , y , z ] to refer to an individual bit with the state array. When

we are more concerned with operations that affect entire lanes, we designate the

5 * 5 matrix as L [x , y ], where each entry in L is a 64-bit lane. The use of indices

within this matrix is shown in Figure 11.16. Thus, the columns are labeled x = 0

through x = 4, the rows are labeled y = 0 through y = 4, and the individual bits

within a lane are labeled z = 0 through z = 63.

The mapping between the bits of s

and those of a is

s [64(5y + x ) + z ] = a [x , y , z ]

We can visualize this with respect to the matrix in Figure 11.16. When treating

the state as a matrix of lanes, the first lane in the lower left corner, L [0, 0], corresponds

to the first 64 bits of s. The lane in the second column, lowest row, L [1, 0],

corresponds to the next 64 bits of s. Thus, the array a is filled with the bits of s starting

with row y = 0 and proceeding row by row.

40

Figure 11.17 S H A-3 Iteration Function f

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

The function f is executed once for each input block of the message

to be hashed. The function takes as input the 1600-bit state variable and converts

it into a 5 * 5 matrix of 64-bit lanes. This matrix then passes through 24 rounds of

processing. Each round consists of five steps, and each step updates the state matrix

by permutation or substitution operations. As shown in Figure 11.17, the rounds are

identical with the exception of the final step in each round, which is modified by a

round constant that differs for each round.

41

Table 11.6 Step Functions in S H A-3

Function Type Description
Substitution New value Of each bit in each word depends its current value and on one bit in each word of preceding column and one bit of each word in succeeding column.
Permutation The bits of each word are permuted using a circular bit shift. is not affected.
Permutation Words are permuted in the 5x5 matrix. not affected.
Substitution New value of each bit in each word depends on its current value and on one bit in next word in the same row and one bit in the second next word in the same row.
Substitution is updated by XOR with a round constant.

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

Table 11.6 summarizes the operation of the five steps. The steps have a simple

description leading to a specification that is compact and in which no trapdoor

can be hidden. The operations on lanes in the specification are limited to bitwise

Boolean operations (XOR, AND, NOT) and rotations. There is no need for table

lookups, arithmetic operations, or data-dependent rotations. Thus, SHA-3 is easily

and efficiently implemented in either hardware or software.

42

Figure 11.18 Theta and Chi Step Functions

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

Figure 11.18b illustrates the operation of the x function on the bits of the

lane L [3, 2]. This is the only one of the step functions that is a nonlinear mapping.

Without it, the SHA-3 round function would be linear.

43

Figure 11.19 Pi Step Function

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

Figure 11.19 Pi Step Function

44

Table 11.8 Round Constants in S H A-3 (1 of 2)

Round Constant (hexadecimal) Number of 1 bits
0 0000000000000001 1
1 0000000000008082 3
2 800000000000808A 5
3 8000000080008000 3
4 000000000000808B 5
5 0000000080000001 2
6 8000000080008081 5
7 8000000000008009 4
8 000000000000008A 3
9 0000000000000088 2
10 0000000080008009 4
11 000000008000000A 3

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

Table 11.8 lists the 24 64-bit round constants. Note that the Hamming weight,

or number of 1 bits, in the round constants ranges from 1 to 6. Most of the bit positions

are zero and thus do not change the corresponding bits in L [0, 0]

45

Table 11.8 Round Constants in S H A-3 (2 of 2)

Round Constant (hexadecimal) Number of 1 bits
12 000000008000808B 6
13 800000000000008B 5
14 8000000000008089 5
15 8000000000008003 4
16 8000000000008002 3
17 8000000000000080 2
18 000000000000800A 3
19 800000008000000A 4
20 8000000080008081 5
21 8000000000008080 3
22 0000000080000001 2
23 8000000080008008 4

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

Table 11.8 lists the 24 64-bit round constants. Note that the Hamming weight,

or number of 1 bits, in the round constants ranges from 1 to 6. Most of the bit positions

are zero and thus do not change the corresponding bits in L [0, 0]

46

Summary

Applications of cryptographic hash functions

Message authentication

Digital signatures

Other applications

Requirements and security

Security requirements for cryptographic hash functions

Brute-force attacks

Cryptanalysis

Hash functions based on cipher block chaining

Secure hash algorithm (S H A)

S H A-512 logic

S H A-512 round function

S H A-3

The sponge construction

The S H A-3 Iteration Function f

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

Chapter 11 summary.

47

Copyright

Copyright © 2017 Pearson Education, Inc. All Rights Reserved

48

(

)

h = HM

M

H

| | E

PRa PUa

E

K

D

K

M

D

H

Compare

(b)

Figure 11.4 Simplified Examples of Digital Signatures

E(PRa, H(M))

E(K, [M || E(PRa, H(M))])

Destination BSource A

PRa PUa

M

H

| |

(a)

M

E D

H

Compare

E(PRa, H(M))

H(F)

ii1i2im

C bxor bxor . . . xor b

=

-

(

)

h Hx

=

(

)

(

)

x y and Hx Hy

¹=

(

)

Hx

(

)

Hyh.

=

    

withH()H().

¹=

yxyx

(

)

(

)

(

)

x. y such that Hx Hy.

x,

of

x’

variations

2

m/2

of

all

y,

of

y’

,

y’

each

for

checks

),

(y’

H

)

(x’

H

y’

a

until

values

x’

12N

M, M, . . . , M

0

H initial value

=

iii1

H EM,H

()

-

=

N

G H

=

64

2

<

64

2

<

128

2

<

128

2

<

128

2

<

128

2

<

112

2

<

128

2

<

192

2

<

256

2

<

224

2

<

256

2

<

384

2

<

512

2

<

q

r

p

c

i

w[0,0]

w[0,0]