hamming256.h
1 /*
2  * Copyright (C) 2015 Lucas Jenß
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
18 #ifndef ECC_HAMMING256_H
19 #define ECC_HAMMING256_H
20 
21 #include <stdint.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 
29 #define Hamming_ERROR_NONE 0
30 
32 #define Hamming_ERROR_SINGLEBIT 1
33 
35 #define Hamming_ERROR_ECC 2
36 
38 #define Hamming_ERROR_MULTIPLEBITS 3
39 
40 
49 void hamming_compute256x( const uint8_t *data, uint32_t size, uint8_t *code );
50 
51 
64 uint8_t hamming_verify256x( uint8_t *data, uint32_t size, const uint8_t *code );
65 
66 
67 #ifdef __cplusplus
68 }
69 #endif
70 
71 #endif /* ECC_HAMMING256_H */
72 
hamming_compute256x
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.
hamming_verify256x
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.