XXTEA block cipher.
More...
#include <lib/random/xxtea.h>
#include <assert.h>
|
#define | XXTEA_DELTA UINT32_C(0x9e3779b9) |
| XXTEA magic number.
|
|
|
static uint32_t | xxtea_mx (uint32_t y, uint32_t z, uint32_t sum, unsigned p, unsigned e, const uint32_t key[4]) |
| Main XXTEA Feistel network based routine. More...
|
|
void | xxtea_encode (uint32_t *restrict v, unsigned n, uint32_t const key[restrict 4]) |
| Encode a array of data with the XXTEA algorithm Encoding is done in place. More...
|
|
void | xxtea_decode (uint32_t *restrict v, unsigned n, uint32_t const key[restrict 4]) |
| Decode a array of data with the XXTEA algorithm Decoding is done in place. More...
|
|
XXTEA block cipher.
An implementation of the XXTEA block cipher (code based on "Correction to xtea" by David J. Wheeler and Roger M. Needham)
- Copyright
- Copyright (C) 2008-2022 HPDCS Group https://hpdcs.github.io
◆ xxtea_decode()
void xxtea_decode |
( |
uint32_t *restrict |
v, |
|
|
unsigned |
n, |
|
|
uint32_t const |
key[restrict 4] |
|
) |
| |
Decode a array of data with the XXTEA algorithm Decoding is done in place.
- Parameters
-
v | a pointer to the array of data to decode |
n | the number of 32 bits blocks in v |
key | the key used to perform the decoding |
◆ xxtea_encode()
void xxtea_encode |
( |
uint32_t *restrict |
v, |
|
|
unsigned |
n, |
|
|
uint32_t const |
key[restrict 4] |
|
) |
| |
Encode a array of data with the XXTEA algorithm Encoding is done in place.
- Parameters
-
v | a pointer to the array of data to encode |
n | the number of 32 bits blocks in v |
key | the key used to perform the encoding |
◆ xxtea_mx()
static uint32_t xxtea_mx |
( |
uint32_t |
y, |
|
|
uint32_t |
z, |
|
|
uint32_t |
sum, |
|
|
unsigned |
p, |
|
|
unsigned |
e, |
|
|
const uint32_t |
key[4] |
|
) |
| |
|
inlinestatic |
Main XXTEA Feistel network based routine.
- Parameters
-
y | the y block to mix |
z | the z block to mix |
sum | the cumulative sum of XXTEA delta values |
p | an helper key block selector value |
e | an helper key block selector value |
key | the key used for encoding/decoding |
- Returns
- the value of the next y/z block