Documentation ¶
Overview ¶
Package fastRNG is an implementation of the Fortuna construction as specified by Ferguson, Schneier and Kohno in 'Cryptography Engineering: Design Principles and Practical Applications' Link: https://www.schneier.com/academic/paperfiles/fortuna.pdf
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
func (*Stream) Close ¶
func (s *Stream) Close()
Closes the stream returning it to its source generator if there is room in the pool
func (Stream) Read ¶
Read reads up to len(b) bytes from the csprng.Source object. This function returns and error if the stream is locked. Users of stream objects should close them when they are finished using them. We read the AES BlockSize into AES then run it until blockSize*scalingFactor bytes are read. Every time BlockSize*scalingFactor bytes are read this functions blocks until it rereads csprng.Source. Will crash if the stream has been closed.
type StreamGenerator ¶
type StreamGenerator struct {
// contains filtered or unexported fields
}
func NewStreamGenerator ¶
func NewStreamGenerator(scalingFactor uint, maxWaiting uint, rng csprng.SourceConstructor) *StreamGenerator
NewStreamGenerator creates a StreamGenerator object containing streamCount streams. The passed in rngConstructor will be the source of randomness for the streams. maxWaiting allows the creation of a pool for the reuse of streams. To reuse a stream it must be closed, then it will be returned on the next attempted get of a new stream. Set it to zero if reuse isn't wanted
func (*StreamGenerator) GetStream ¶
func (sg *StreamGenerator) GetStream() *Stream
GetStream gets an existing stream or creates a new stream object. It returns a new stream object if none can be retrieved from the pool of waiting streams