Added XTEA and Pearson Hashing.
Improved message encryption for RF24.
This commit is contained in:
@@ -36,9 +36,16 @@
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define PROTOCOL_VERSION (2u) //!< The version of the protocol
|
||||
#define MAX_MESSAGE_LENGTH (32u) //!< The maximum size of a message (including header)
|
||||
#if (defined (MY_MESSAGE_ENABLE_HASH) && defined(MY_MESSAGE_ENABLE_NONCE))
|
||||
#define HEADER_SIZE (11u) //!< The size of the header
|
||||
#elif (defined (MY_MESSAGE_ENABLE_HASH) || defined(MY_MESSAGE_ENABLE_NONCE))
|
||||
#define HEADER_SIZE (9u) //!< The size of the header
|
||||
#else
|
||||
#define HEADER_SIZE (7u) //!< The size of the header
|
||||
#endif
|
||||
#define MAX_PAYLOAD (MAX_MESSAGE_LENGTH - HEADER_SIZE) //!< The maximum size of a payload depends on #MAX_MESSAGE_LENGTH and #HEADER_SIZE
|
||||
|
||||
/// @brief The command field (message-type) defines the overall properties of a message
|
||||
@@ -495,6 +502,15 @@ typedef union {
|
||||
* 3 bit - Payload data type
|
||||
*/
|
||||
uint8_t command_ack_payload;
|
||||
|
||||
#if defined (MY_MESSAGE_ENABLE_NONCE)
|
||||
// The salt/nonce need to be in the first XTEA block
|
||||
uint16_t _nounce; // 16 bit - nounce
|
||||
#endif
|
||||
|
||||
#if defined (MY_MESSAGE_ENABLE_HASH)
|
||||
uint16_t _hash; // 16 bit - CRC16 checksum
|
||||
#endif
|
||||
|
||||
uint8_t type; ///< 8 bit - Type varies depending on command
|
||||
uint8_t sensor; ///< 8 bit - Id of sensor that this message concerns.
|
||||
|
||||
Reference in New Issue
Block a user