21.03.2013 Views

Problem - Kevin Tafuro

Problem - Kevin Tafuro

Problem - Kevin Tafuro

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Solution<br />

See the “Discussion” section. Be sure to note the possible attacks on these constructs,<br />

and how to thwart them.<br />

Discussion<br />

One common thread running through the three types of primitives described in this<br />

chapter is that they take an arbitrary amount of data as an input, and produce a<br />

fixed-size output. The output is always identical given the exact same inputs (where<br />

inputs may include keys, nonces, and text). In addition, in each case, given random<br />

inputs, every output is (just about) equally likely.<br />

Types of primitives<br />

These are the three types of primitives:<br />

Message authentication codes<br />

MACs are hash functions that take a message and a secret key (and possibly a<br />

nonce) as input, and produce an output that cannot, in practice, be forged without<br />

possessing the secret key. This output is often called a tag. There are many<br />

ways to build a secure MAC, and there are several good MACs available, including<br />

OMAC, CMAC, and HMAC.<br />

Cryptographic hash functions<br />

These functions are the simplest of the primitives we’ll discuss (even though they<br />

are difficult to use securely). They simply take an input string and produce a<br />

fixed-size output string (often called a hash value or message digest). Given the<br />

output string, there should be no way to determine the input string other than<br />

guessing (a dictionary attack). Traditional algorithms include SHA1 and MD5,<br />

but you can use algorithms based on block ciphers (and, indeed, you can get<br />

more assurance from a block cipher-based construction). Cryptographic hash<br />

functions generally are not secure on their own. They are securely used in public<br />

key cryptography, and are used as a component in a type of MAC called HMAC.<br />

Universal hash functions<br />

These are keyed hash functions with specific mathematical properties that can<br />

also be used as MACs, despite the fact that they’re not cryptographically secure.<br />

It turns out that if you take the output of a keyed universal hash function, and<br />

combine it with seemingly random bits in particular ways (such as encrypting<br />

the result with a block cipher), the result has incredibly good security properties.<br />

Or, if you are willing to use one-time keys that are securely generated, you<br />

don’t have to use encryption at all! Dan Bernstein’s hash127 is an example of a<br />

fast, freely available universal hash function. Most people don’t use universal<br />

hash functions directly. They’re usually used under the hood in a MAC. For<br />

example, CMAC uses a hash127-like function as its foundation.<br />

250 | Chapter 6: Hashes and Message Authentication<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!