21.03.2013 Views

Problem - Kevin Tafuro

Problem - Kevin Tafuro

Problem - Kevin Tafuro

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter CHAPTER 11 11<br />

Random Numbers<br />

Security-critical applications often require well-chosen random numbers, for purposes<br />

ranging from cryptographic key generation to shuffling a virtual deck of cards.<br />

Even though problems with random numbers seem as if they should be few and far<br />

between, such problems are disturbingly common. Part of the problem is that computers<br />

are fundamentally deterministic and therefore are not very good at doing anything<br />

unpredictable. However, input from a user can introduce real randomness into<br />

a system.<br />

This chapter discusses how to get secure random numbers for your application. We<br />

describe how to take a single, secure, random number (a seed), and stretch it into a<br />

big stream of random numbers using a secure pseudo-random number generator.<br />

We talk about how to get random data in lots of different representations (e.g., an<br />

integer in a particular range or a printable string). We also discuss how to get real<br />

randomness in an environment that is fundamentally deterministic, and we give<br />

advice on figuring out how to estimate how much randomness exists in a piece of<br />

data.<br />

11.1 Determining What Kind of Random<br />

Numbers to Use<br />

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

Your application has a need for random numbers. You must figure out what you<br />

need to do to get adequate randomness as cheaply as possible, yet still meet your<br />

security properties. To do that, you need to understand what kinds of options are<br />

available to you and what the trade-offs are.<br />

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