libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
Loading...
Searching...
No Matches
gf256.h
Go to the documentation of this file.
1/*
2 * This file is part of the Aaru Data Preservation Suite.
3 * Copyright (c) 2019-2026 Natalia Portillo.
4 *
5 * This library is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation; either version 2.1 of the
8 * License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef LIBAARUFORMAT_GF256_H
20#define LIBAARUFORMAT_GF256_H
21
22#include <stddef.h>
23#include <stdint.h>
24
31uint8_t gf256_mul(uint8_t a, uint8_t b);
32
39uint8_t gf256_div(uint8_t a, uint8_t b);
40
46uint8_t gf256_inv(uint8_t a);
47
59void gf256_mul_region(uint8_t *dst, const uint8_t *src, uint8_t coeff, size_t len);
60
70void gf256_xor_region(uint8_t *dst, const uint8_t *src, size_t len);
71
72#endif /* LIBAARUFORMAT_GF256_H */
uint8_t gf256_div(uint8_t a, uint8_t b)
Divide two elements in GF(2^8).
Definition gf256.c:84
void gf256_xor_region(uint8_t *dst, const uint8_t *src, size_t len)
XOR a region: dst[i] ^= src[i] for all i.
Definition gf256.c:344
uint8_t gf256_inv(uint8_t a)
Compute multiplicative inverse in GF(2^8).
Definition gf256.c:92
void gf256_mul_region(uint8_t *dst, const uint8_t *src, uint8_t coeff, size_t len)
Multiply-accumulate a region: dst[i] ^= GF_mul(src[i], coeff) for all i.
Definition gf256.c:324
uint8_t gf256_mul(uint8_t a, uint8_t b)
Multiply two elements in GF(2^8) with polynomial 0x11D.
Definition gf256.c:77