XTEA cipher library with MAC code calculation support for Arduino environment. Supported encryption modes are: ECB, CFB and OCB and for generating message authentication codes is CFB-MAC. 'C' code of this library was optimized for lowest possible use of program memory. Contrary to reference implementation, base data type is uint8_t[] instead of uint32_t.
Configure library settings in file xtea.h
, or better in your sketch, by adding directive #define XTEA_ROUNDS n
or/and #define XTEA_MAC_ROUNDS n
before directive including this cipher library e.g.:
...
#define XTEA_ROUNDS 48
#define XTEA_MAC_ROUNDS 24
#include "XTEA-Cipher.h"
...
-
XTEA_ROUNDS
actual number of Feistel rounds during cipher is
2 * XTEA_ROUNDS
[default value is
32
] -
XTEA_MAC_ROUNDS
actual number of Feistel rounds during MAC calculation is
2 * XTEA_MAC_ROUNDS
[default value is
32
]
known attack is on 36 Feistel rounds (18
XTEA_ROUNDS
orXTEA_MAC_ROUNDS
) -
XTEA_BLOCK_SIZE
data block size = 64-bit [8 bytes]
[Do NOT change its value]
-
XTEA_IV_SIZE
size of initialization vector [IV] (a.k.a. NONCE) = 64-bit [8 bytes]
[Do NOT change its value]
-
XTEA_KEY_SIZE
key size = 128-bit [16 bytes]
[Do NOT change its value]
Read the source code for details.
-
Sketch shows examples of calling 'C' code functions and validating them with test vectors.
-
This sketch shows examples of calling methods of a c++ class and validating them with test vectors.
Arduino IDE - Additional libraries installation guide.
Copyright © 2020-2021 Michal Protasowicki
Source: https://github.com/michpro/XTEA-Cipher
This project is released under MIT License.
If You find my projects interesting and You wanted to support my work, You can give me a cup of coffee or a keg of beer :)