Page Speed Optimization Libraries
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | List of all members
net_instaweb::HashedNonceGenerator Class Reference

#include "hashed_nonce_generator.h"

Inheritance diagram for net_instaweb::HashedNonceGenerator:

Public Member Functions

 HashedNonceGenerator (const Hasher *hasher, StringPiece key, AbstractMutex *mutex)
- Public Member Functions inherited from net_instaweb::NonceGenerator
uint64 NewNonce ()
 Generate a fresh, ideally cryptographic, nonce. Thread-safe.

Protected Member Functions

virtual uint64 NewNonceImpl ()
 Subclasses must implement this method. Locking is already handled.
- Protected Member Functions inherited from net_instaweb::NonceGenerator
 NonceGenerator (AbstractMutex *mutex)
 Takes ownership of mutex.

Detailed Description

Implements a NonceGenerator using a hasher and a count, starting from an initial secret. See: Basically we initialize a key and a counter with random data, then return the hash of the string obtained by appending them. Incrementing the counter gives us a new hash. This means that different instantiations of a HashedNonceGenerator must use different keys to avoid repetition of nonce values. Note that (according to the above article) this is sufficient for cryptographic nonce generation, but not for generating a cryptographically secure bit stream for use as a one-time pad.

Constructor & Destructor Documentation

net_instaweb::HashedNonceGenerator::HashedNonceGenerator ( const Hasher hasher,
StringPiece  key,
AbstractMutex mutex 

key must be at least 2*hasher->RawHashSizeInBytes() in length. Takes ownership of mutex, but not of hasher.

The documentation for this class was generated from the following file: