Crunch
A Message Definition Language for Getting Things Right
Loading...
Searching...
No Matches
Crunch::integrity::Parity Struct Reference

Simple XOR parity integrity policy. More...

#include <crunch_integrity.hpp>

Static Public Member Functions

static constexpr std::size_t size () noexcept
 
static constexpr auto calculate (std::span< const std::byte > data) noexcept -> std::array< std::byte, 1 >
 Calculates XOR parity.
 

Detailed Description

Simple XOR parity integrity policy.

Adds 1 byte of overhead. XORs all bytes together for a simple parity check.

Member Function Documentation

◆ calculate()

static constexpr auto Crunch::integrity::Parity::calculate ( std::span< const std::byte >  data) -> std::array<std::byte, 1>
inlinestaticconstexprnoexcept

Calculates XOR parity.

Parameters
dataThe byte span to calculate parity over.
Returns
1-byte array containing the parity byte.

The documentation for this struct was generated from the following file: