8 Randomness and Secrets

 

This chapter covers:

  • What randomness is and why it’s important.
  • Obtaining strong randomness and producing secrets for cryptography.
  • What the pitfalls of randomness are.

This is the last chapter of the first part of this book, and I have one last thing to tell you before we move on to the second part of this book and learn about actual protocols used in the real world. It is something I’ve grossly overlooked at so far: randomness.

You must have noticed that in every cryptographic algorithm you’ve learned, with the exception of hash functions, you had to use randomness at some point. Secret keys, nonces, IVs, prime numbers, and so on. As I was going through these different concepts, randomness always came from some magic black box as illustrated in figure 8.1.

Figure 8.1. Randomness in practice is often ignored and abstracted by cryptography as a black box that magically provides random numbers for us. This chapter will teach you where this randomness comes from in practice and how you can obtain it.
random

In this chapter, I will provide you with explanations as to what cryptography means when it mentions randomness, and what are the practical ways that exist to obtain randomness for real world cryptographic applications.

Prerequisites:

  • Chapter 2 on hash functions.
  • Chapter 3 on message authentication codes.

8.1  What is Randomness?

8.2  What is a Pseudo-Random Number Generator (PRNG)?

8.3  Obtaining Randomness in Practice

8.4  Randomness Generation and Security Considerations

8.5  Public Randomness

8.6  Key Derivation With HKDF

8.7  Managing Keys and Secrets

8.8  Avoiding Key Management, Or How To Split Trust

8.9  Summary

sitemap