1
0
mirror of https://github.com/esphome/esphome.git synced 2025-04-14 06:40:32 +01:00
Clyde Stubbs 1215d2ffeb
[xxtea] Extract encryption functions to separate component (#8183)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2025-02-05 12:22:40 +13:00

27 lines
698 B
C++

#pragma once
#include <cstdint>
#include <cstddef>
namespace esphome {
namespace xxtea {
/**
* Encrypt a block of data in-place using XXTEA algorithm with 256-bit key
* @param v Data to encrypt (as array of 32-bit words)
* @param n Number of 32-bit words in data
* @param k Key (array of 8 32-bit words)
*/
void encrypt(uint32_t *v, size_t n, const uint32_t *k);
/**
* Decrypt a block of data in-place using XXTEA algorithm with 256-bit key
* @param v Data to decrypt (as array of 32-bit words)
* @param n Number of 32-bit words in data
* @param k Key (array of 8 32-bit words)
*/
void decrypt(uint32_t *v, size_t n, const uint32_t *k);
} // namespace xxtea
} // namespace esphome