Offline Transaction Signing (OTS) 0.1.0
Loading...
Searching...
No Matches
ots::Entropy Class Reference

Entropy check functions. More...

#include <entropy.hpp>

Static Public Member Functions

static bool allBytesIdentical (const uint8_t *data, size_t size) noexcept
 Check if all bytes are identical @data the data to check @size the size of the data.
 
static bool isIncrementalSequence (const uint8_t *data, size_t size) noexcept
 Check if bytes are an incremental sequence @data the data to check @size the size of the data.
 
static bool hasRepeatingSubpattern (const uint8_t *data, size_t size, uint8_t pattern) noexcept
 Check if bytes have a repeating subpattern @data the data to check @size the size of the data.
 
static double shannonEntropy (const uint8_t *data, size_t size) noexcept
 Check the Shannon entropy index of the data.
 
static bool mostlyExtremes (const uint8_t *data, size_t size) noexcept
 Check if the data is mostly extremes.
 

Detailed Description

Entropy check functions.

Member Function Documentation

◆ allBytesIdentical()

bool ots::Entropy::allBytesIdentical ( const uint8_t *  data,
size_t  size 
)
staticnoexcept

Check if all bytes are identical @data the data to check @size the size of the data.

Returns
true if all bytes are identical

◆ hasRepeatingSubpattern()

bool ots::Entropy::hasRepeatingSubpattern ( const uint8_t *  data,
size_t  size,
uint8_t  pattern 
)
staticnoexcept

Check if bytes have a repeating subpattern @data the data to check @size the size of the data.

Returns
true if the data has a repeating subpattern

◆ isIncrementalSequence()

bool ots::Entropy::isIncrementalSequence ( const uint8_t *  data,
size_t  size 
)
staticnoexcept

Check if bytes are an incremental sequence @data the data to check @size the size of the data.

Returns
true if the data is an incremental sequence

◆ mostlyExtremes()

bool ots::Entropy::mostlyExtremes ( const uint8_t *  data,
size_t  size 
)
staticnoexcept

Check if the data is mostly extremes.

Note
The data is mostly 0x00 or 0xFF

◆ shannonEntropy()

double ots::Entropy::shannonEntropy ( const uint8_t *  data,
size_t  size 
)
staticnoexcept

Check the Shannon entropy index of the data.

Note
The entropy is calculated as -Σ p(x) * log2(p(x))
See also
https://en.wikipedia.org/wiki/Entropy_(information_theory)

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