Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
ENTROPY: randomness metrics for byte samples

Functions

double n_entropy_chi_square (const unsigned char *data, size_t len)
 Chi-square statistic of the byte histogram against a uniform distribution over 256 values.
 
double n_entropy_monobit (const unsigned char *data, size_t len)
 Fraction of set bits in the sample (0.0 .
 
double n_entropy_shannon (const unsigned char *data, size_t len)
 Shannon entropy of the byte sample, in bits per byte (0.0 .
 

Detailed Description

Function Documentation

◆ n_entropy_chi_square()

double n_entropy_chi_square ( const unsigned char *  data,
size_t  len 
)

Chi-square statistic of the byte histogram against a uniform distribution over 256 values.

Near 255 (the degrees of freedom) for random data; large for skewed data. Returns 0.0 for an empty/NULL sample.

Definition at line 64 of file n_entropy.c.

Referenced by main().

+ Here is the caller graph for this function:

◆ n_entropy_monobit()

double n_entropy_monobit ( const unsigned char *  data,
size_t  len 
)

Fraction of set bits in the sample (0.0 .

. 1.0); 0.5 is the ideal for random data (the FIPS monobit idea). Returns 0.0 for an empty/NULL sample.

Definition at line 48 of file n_entropy.c.

Referenced by main().

+ Here is the caller graph for this function:

◆ n_entropy_shannon()

double n_entropy_shannon ( const unsigned char *  data,
size_t  len 
)

Shannon entropy of the byte sample, in bits per byte (0.0 .

. 8.0). 0 means a single repeated value; 8 means a perfectly uniform byte histogram. Returns 0.0 for an empty/NULL sample.

Definition at line 29 of file n_entropy.c.

Referenced by main().

+ Here is the caller graph for this function: