diff options
author | iphydf <iphydf@users.noreply.github.com> | 2017-03-26 19:23:31 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2017-03-30 19:36:43 +0000 |
commit | aa2310ad2a8b4e3cbe6beaf61fcf4066752a02fa (patch) | |
tree | 6128ff1b75380016018d8307a9a224f4ac852b35 | |
parent | c780d25e3e08267f9c225f8d576892f771db801e (diff) |
Add TOX_NOSPAM_SIZE to the public API.
Fixes #456.
-rw-r--r-- | toxcore/tox.api.h | 7 | ||||
-rw-r--r-- | toxcore/tox.h | 9 |
2 files changed, 14 insertions, 2 deletions
diff --git a/toxcore/tox.api.h b/toxcore/tox.api.h index b678f423..281cb998 100644 --- a/toxcore/tox.api.h +++ b/toxcore/tox.api.h | |||
@@ -241,6 +241,11 @@ const PUBLIC_KEY_SIZE = 32; | |||
241 | const SECRET_KEY_SIZE = 32; | 241 | const SECRET_KEY_SIZE = 32; |
242 | 242 | ||
243 | /** | 243 | /** |
244 | * The size of the nospam in bytes when written in a Tox address. | ||
245 | */ | ||
246 | const NOSPAM_SIZE = sizeof(uint32_t); | ||
247 | |||
248 | /** | ||
244 | * The size of a Tox address in bytes. Tox addresses are in the format | 249 | * The size of a Tox address in bytes. Tox addresses are in the format |
245 | * [Public Key ($PUBLIC_KEY_SIZE bytes)][nospam (4 bytes)][checksum (2 bytes)]. | 250 | * [Public Key ($PUBLIC_KEY_SIZE bytes)][nospam (4 bytes)][checksum (2 bytes)]. |
246 | * | 251 | * |
@@ -248,7 +253,7 @@ const SECRET_KEY_SIZE = 32; | |||
248 | * byte is an XOR of all the even bytes (0, 2, 4, ...), the second byte is an | 253 | * byte is an XOR of all the even bytes (0, 2, 4, ...), the second byte is an |
249 | * XOR of all the odd bytes (1, 3, 5, ...) of the Public Key and nospam. | 254 | * XOR of all the odd bytes (1, 3, 5, ...) of the Public Key and nospam. |
250 | */ | 255 | */ |
251 | const ADDRESS_SIZE = PUBLIC_KEY_SIZE + sizeof(uint32_t) + sizeof(uint16_t); | 256 | const ADDRESS_SIZE = PUBLIC_KEY_SIZE + NOSPAM_SIZE + sizeof(uint16_t); |
252 | 257 | ||
253 | /** | 258 | /** |
254 | * Maximum length of a nickname in bytes. | 259 | * Maximum length of a nickname in bytes. |
diff --git a/toxcore/tox.h b/toxcore/tox.h index f7724c8f..75757b6f 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h | |||
@@ -246,6 +246,13 @@ uint32_t tox_public_key_size(void); | |||
246 | uint32_t tox_secret_key_size(void); | 246 | uint32_t tox_secret_key_size(void); |
247 | 247 | ||
248 | /** | 248 | /** |
249 | * The size of the nospam in bytes when written in a Tox address. | ||
250 | */ | ||
251 | #define TOX_NOSPAM_SIZE (sizeof(uint32_t)) | ||
252 | |||
253 | uint32_t tox_nospam_size(void); | ||
254 | |||
255 | /** | ||
249 | * The size of a Tox address in bytes. Tox addresses are in the format | 256 | * The size of a Tox address in bytes. Tox addresses are in the format |
250 | * [Public Key (TOX_PUBLIC_KEY_SIZE bytes)][nospam (4 bytes)][checksum (2 bytes)]. | 257 | * [Public Key (TOX_PUBLIC_KEY_SIZE bytes)][nospam (4 bytes)][checksum (2 bytes)]. |
251 | * | 258 | * |
@@ -253,7 +260,7 @@ uint32_t tox_secret_key_size(void); | |||
253 | * byte is an XOR of all the even bytes (0, 2, 4, ...), the second byte is an | 260 | * byte is an XOR of all the even bytes (0, 2, 4, ...), the second byte is an |
254 | * XOR of all the odd bytes (1, 3, 5, ...) of the Public Key and nospam. | 261 | * XOR of all the odd bytes (1, 3, 5, ...) of the Public Key and nospam. |
255 | */ | 262 | */ |
256 | #define TOX_ADDRESS_SIZE (TOX_PUBLIC_KEY_SIZE + sizeof(uint32_t) + sizeof(uint16_t)) | 263 | #define TOX_ADDRESS_SIZE (TOX_PUBLIC_KEY_SIZE + TOX_NOSPAM_SIZE + sizeof(uint16_t)) |
257 | 264 | ||
258 | uint32_t tox_address_size(void); | 265 | uint32_t tox_address_size(void); |
259 | 266 | ||