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.

easily last years. The 128-bit version generally does a bit better than half the<br />

speed of the 64-bit version. Nevertheless, although there are a few things out<br />

there using UMAC, we don’t recommend it. The algorithm is complex enough<br />

that, as of this writing, the reference implementation of UMAC apparently has<br />

never been validated. In addition, interoperability with UMAC is exceptionally<br />

difficult because there are many different parameters that can be tweaked.<br />

XMACC<br />

XMACC can be built from a large variety of cryptographic primitives. It provides<br />

good performance characteristics, and it is fully parallelizable. Unfortunately,<br />

it is patented, and for this reason we won’t discuss it further in this book.<br />

All in all, we personally prefer MAC127 or CMAC. When you want to avoid using a<br />

nonce, OMAC1 is an excellent choice.<br />

See Also<br />

Recipes 4.11, 5.4, 5.10, 6.9 through 6.14<br />

6.5 Incrementally Hashing Data<br />

<strong>Problem</strong><br />

You want to use a hash function to process data incrementally, returning a result<br />

when the last of the data is finally available.<br />

Solution<br />

Most hash functions use a standard interface for operation, following these steps:<br />

1. The user creates a “context” object to hold intermediate state.<br />

2. The context object gets initialized.<br />

3. The context is “updated” by passing in the data to be hashed.<br />

4. When the data is updated, “finalization” returns the output of the cryptographic<br />

hash function.<br />

Discussion<br />

Hash functions are not secure by themselves—not for a password system,<br />

not for message authentication, not for anything! If you do need a<br />

hash function by itself, be sure to at least protect against length extension<br />

attacks, as described in Recipes 6.7 and 6.8.<br />

262 | 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!