hamming256.h
1 /*
2  * SPDX-FileCopyrightText: 2015 Lucas Jenß
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
17 #include <stdint.h>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
24 #define Hamming_ERROR_NONE 0
25 
27 #define Hamming_ERROR_SINGLEBIT 1
28 
30 #define Hamming_ERROR_ECC 2
31 
33 #define Hamming_ERROR_MULTIPLEBITS 3
34 
43 void hamming_compute256x( const uint8_t *data, uint32_t size, uint8_t *code );
44 
57 uint8_t hamming_verify256x( uint8_t *data, uint32_t size, const uint8_t *code );
58 
59 #ifdef __cplusplus
60 }
61 #endif
62 
void hamming_compute256x(const uint8_t *data, uint32_t size, uint8_t *code)
Computes 3-bytes hamming codes for a data block whose size is multiple of 256 bytes.
uint8_t hamming_verify256x(uint8_t *data, uint32_t size, const uint8_t *code)
Verifies 3-bytes hamming codes for a data block whose size is multiple of 256 bytes.