From 382c41f9a6449fb11928359cf5b4f2a16f6bca39 Mon Sep 17 00:00:00 2001 From: neithanmo Date: Mon, 25 Nov 2024 22:59:06 +0100 Subject: [PATCH] New constants --- app/src/constants.h | 13 +++++++++++++ app/src/keys_def.h | 3 --- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/src/constants.h b/app/src/constants.h index 1a3ec6d..657e33d 100644 --- a/app/src/constants.h +++ b/app/src/constants.h @@ -15,6 +15,9 @@ ********************************************************************************/ #define U128_STR_MAX_LEN 40 +// raw address len before encoding +#define ADDRESS_LEN_BYTES 80 + // Common BECH32m constants #define CHECKSUM_LENGTH 8 #define BECH32_BITS_PER_CHAR 5 @@ -39,3 +42,13 @@ #define ENCODED_ADDR_LEN (ADDR_HRP_LENGTH + SEPARATOR_LENGTH + ENCODED_DATA_LENGTH) #define ENCODED_ADDR_BUFFER_SIZE (ENCODED_ADDR_LEN + 2) + + +// MEMO transaction constants +#dfine MEMO_CIPHERTEXT_LEN_BYTES 528 + +// This is the `MEMO_CIPHERTEXT_LEN_BYTES` - MAC size (16 bytes). +#define MEMO_LEN_BYTES 512 + +// This is the largest text length we can support +#define MAX_TEXT_LEN MEMO_LEN_BYTES - ADDRESS_LEN_BYTES diff --git a/app/src/keys_def.h b/app/src/keys_def.h index b58cafc..71957ec 100644 --- a/app/src/keys_def.h +++ b/app/src/keys_def.h @@ -32,9 +32,6 @@ extern "C" { #define INCOMING_VIEWING_KEY_LEN KEY_LEN // Assuming modulo r size #define ADDR_MAX_ENC_LEN 150 // The maximun length of the encoded address -// raw address len before encoding -#define ADDRESS_LEN_BYTES 80 - /// Number of bits in the address short form divided by the number of bits per Bech32m character #define ADDRESS_NUM_CHARS_SHORT_FORM 24