Docsity

Understanding Hash Functions and Message Digests: Security and Complexity, Quizzes of Computer Networks

Partial preview of the text

Download Understanding Hash Functions and Message Digests: Security and Complexity and more Quizzes Computer Networks in PDF only on Docsity!

HASHES AND MESSAGE

DIGESTS

Dr. Nguyen Tuan Nam [email protected]

INTRODUCTION

A hash (message digest) is a one-way function Takes an input message and produces an output Not practical to figure out what input corresponds to a given output For a message digest function to be considered cryptographically secure  must be computationally infeasible to find A message that has a given pre-specified message digest 2 messages that have the same message digest Given a message, impossible to find a different message with the same message digest All of the digest/hash algorithms Take an arbitrary-length message and wind up with a fixed- length quantity

HOW TO DEFINE A GOOD

MESSAGE DIGEST FUNCTION

There certainly will be many messages that yield the same message digest. Why? Example  For 1000-bit messages and a 128-bit message digest, on the average, how many messages are there that map to any one particular message digest? Certainly by trying lots of messages  one would eventually find 2 that mapped to the same message digest. “Trying a lot” means essentially impossible.

FINGERPRINT

Fingerprint a program or a document to detect modification of it. How?

THE BIRTHDAY

If there are 23 or more people in a room  the odds are

better than 50% that 2 of them will have the same birthday

Assume

 n selected inputs and k possible outputs  Unpredictable mapping from input to output

With n inputs  n*(n-1)/2 pairs of inputs

Each pair: probability of 1/k of both inputs producing the same

ouput value

Need about k/2 pairs in order for the probability to be about

50% that you’ll find a matching pair

 If n is greater than square_root(k)  good chance of finding

a matching pair

MATCHING PAIR

Assume  n selected inputs and k possible outputs  Unpredictable mapping from input to output With n inputs  n*(n-1)/2 pairs of inputs Each pair: probability of 1/k of both inputs producing the same ouput value Need about k/2 pairs in order for the probability to be about 50% that you’ll find a matching pair  If n is greater than square_root(k)  good chance of finding a matching pair

WHY WORRIED ABOUT SOMEONE BEING ABLE TO FIND ANY 2 MESSAGES WITH THE SAME MESSAGE DIGEST? Because if cryptographers were happy with message digest functions that merely made it infeasible to find a message with a particular pre-specified digest  64-bit digest would suffice

EXAMPLE

Alice wants to fire Fred Alice asks Bob, who happens to be Fred’s friend to compose a letter explaining that Fred should be fired After Bob writes the letter, Alice will read it and sign the message digest using her private key  Bob needs to find 2 messages with the same message digest

THE MATH BEHIND THE MESSAGE DIGEST FUNCTIONS The math behind RSA and other public key cryptographic algorithm is quire understandable In contrast, message digest functions are like alchemy  Bunch of steps that each mangle the message more and more  Possible to follow all the steps  But incomprehensible part is why this particular shuffling of the message is done, and why it couldn’t be simpler and yet just as secure

MINIMAL VS. OVERKILL SECURE MESSAGE DIGEST FUNCTION Message digest function should be easy to compute However, it is safer for a function to be overkill  Shuffling beyond what is necessary  But then harder to compute than necessary Why? Similar to secret key algorithms, the digest algorithms tend to be computed in rounds

THE SIGNIFICANT DIFFERENCE BETWEEN A SECRET KEY ALGORITHM AND A MESSAGE DIGEST FUNCTION Whether it is reversible!

NIFTY THINGS

TO DO WITH

A HASH

Authentication

Computing a MAC

with a Hash

Encryption with a

Message Digest

Using Secret Key for

a Hash

COMPUTING A MAC WITH A HASH

MD (m)?

MD (KAB | m)?

 Attacker may be able to compute a MAC of a longer message beginning with m, given message m and the correct MAC for m

Put the secret at the end of the message instead of the

beginning

Use only half of the bits of the message digest as the MAC

 Having only 64-bits of MAC (rather than using all 128 bits of the MD), will it become less secure?

Concatenate the secret to both the front and the back of the

message

Keyed hash: hash that combines the secret key and the data

ENCRYPTION WITH MESSAGE DIGEST

How? Remember it is irreversible