Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_entropy.c File Reference

Implementation of the byte-sample randomness metrics. More...

#include "nilorea/n_entropy.h"
#include <math.h>
Include dependency graph for n_entropy.c:

Go to the source code of this file.

Functions

size_t n_entropy_bits (const unsigned char *const *samples, size_t count, size_t sample_len, N_ENTROPY_BIT *out, size_t max_out)
 Per-BIT analysis of a set of equal-length samples.
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_chi_square_p (double chi, size_t df)
 Upper-tail p-value of a chi-square statistic (Wilson-Hilferty).
size_t n_entropy_longest_run (const unsigned char *data, size_t len)
 Length of the longest run of identical bits in the sample.
double n_entropy_monobit (const unsigned char *data, size_t len)
 Fraction of set bits in the sample (0.0 .
size_t n_entropy_positions (const unsigned char *const *samples, size_t count, size_t sample_len, N_ENTROPY_POS *out, size_t max_out)
 Per-POSITION analysis of a set of equal-length samples.
double n_entropy_runs_p (const unsigned char *data, size_t len)
 Runs test over the sample's bit stream (NIST SP 800-22 style).
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

Implementation of the byte-sample randomness metrics.

Definition in file n_entropy.c.