Loading...
Searching...
No Matches
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
9#pragma once
10
19
20#include <stdint.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
27#define Hamming_ERROR_NONE 0
28
30#define Hamming_ERROR_SINGLEBIT 1
31
33#define Hamming_ERROR_ECC 2
34
36#define Hamming_ERROR_MULTIPLEBITS 3
37
46void hamming_compute256x( const uint8_t *data, uint32_t size, uint8_t *code );
47
60uint8_t hamming_verify256x( uint8_t *data, uint32_t size, const uint8_t *code );
61
62#ifdef __cplusplus
63}
64#endif
65
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.