Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
sober128.h File Reference
#include "ws_symbol_export.h"

Go to the source code of this file.

Classes

struct  _sober128_prng
 

Typedefs

typedef struct _sober128_prng sober128_prng
 

Functions

WS_DLL_PUBLIC int sober128_start (sober128_prng *prng)
 Initialize a Sober128 PRNG instance.
 
WS_DLL_PUBLIC int sober128_add_entropy (const unsigned char *buf, unsigned long len, sober128_prng *prng)
 Inject entropy into a Sober128 PRNG instance.
 
WS_DLL_PUBLIC unsigned long sober128_read (unsigned char *buf, unsigned long len, sober128_prng *prng)
 Generate random bytes from a Sober128 PRNG instance.
 

Detailed Description

This file is derived from sober128 implementation in corosync cluster engine. corosync cluster engine borrows the implementation from LibTomCrypt.

The latest version of the original code can be found at http://www.libtom.net/LibTomCrypt/ according to which this code is in the Public Domain

Function Documentation

◆ sober128_add_entropy()

WS_DLL_PUBLIC int sober128_add_entropy ( const unsigned char *  buf,
unsigned long  len,
sober128_prng prng 
)

Inject entropy into a Sober128 PRNG instance.

Adds external entropy to the PRNG state, improving randomness quality.

Parameters
bufPointer to entropy bytes.
lenNumber of bytes in buf.
prngPointer to an initialized sober128_prng structure.
Returns
0 on success, or a non-zero value on failure.

◆ sober128_read()

WS_DLL_PUBLIC unsigned long sober128_read ( unsigned char *  buf,
unsigned long  len,
sober128_prng prng 
)

Generate random bytes from a Sober128 PRNG instance.

Fills the output buffer with pseudo-random bytes from the PRNG. The PRNG must be initialized and seeded with entropy before use.

Parameters
bufPointer to buffer to receive random bytes.
lenNumber of bytes to generate.
prngPointer to a seeded sober128_prng structure.
Returns
Number of bytes written to buf.

◆ sober128_start()

WS_DLL_PUBLIC int sober128_start ( sober128_prng prng)

Initialize a Sober128 PRNG instance.

Parameters
prngPointer to a sober128_prng structure to initialize.
Returns
0 on success, or a non-zero value on failure.