Nyx Node
Loading...
Searching...
No Matches
Utilities

Functions

uint32_t nyx_hash (__NYX_ZEROABLE__ size_t size, __NYX_NULLABLE__ BUFF_t buff, uint32_t seed)
 Hashes a buffer using the MurmurHash2 algorithm.
 
void nyx_generate_mac_addr (uint8_t result_mac[6], uint8_t mac0, uint8_t mac1, STR_t node_id)
 Generates a MAC address based on a node identifier.
 
__NYX_NULLABLE__ str_t nyx_base64_encode (__NYX_NULLABLE__ size_t *result_len, __NYX_ZEROABLE__ size_t size, __NYX_NULLABLE__ BUFF_t buff)
 Encodes a buffer using the Base64 algorithm.
 
__NYX_NULLABLE__ buff_t nyx_base64_decode (__NYX_NULLABLE__ size_t *result_size, __NYX_ZEROABLE__ size_t len, __NYX_NULLABLE__ STR_t str)
 Decodes a string using the Base64 algorithm.
 
__NYX_NULLABLE__ buff_t nyx_zlib_deflate (__NYX_NULLABLE__ size_t *result_size, __NYX_ZEROABLE__ size_t size, __NYX_NULLABLE__ BUFF_t buff)
 Compresses a buffer using the ZLib algorithm.
 
__NYX_NULLABLE__ buff_t nyx_zlib_inflate (__NYX_NOTNULL__ size_t *result_size, __NYX_ZEROABLE__ size_t size, __NYX_NULLABLE__ BUFF_t buff)
 Decompresses a buffer using the ZLib algorithm.
 
__NYX_NULLABLE__ str_t nyx_zlib_base64_deflate (__NYX_NULLABLE__ size_t *result_len, __NYX_ZEROABLE__ size_t size, __NYX_NULLABLE__ BUFF_t buff)
 Compresses a buffer using the ZLib+Base64 algorithm.
 
__NYX_NULLABLE__ buff_t nyx_zlib_base64_inflate (__NYX_NOTNULL__ size_t *result_size, __NYX_ZEROABLE__ size_t len, __NYX_NULLABLE__ STR_t str)
 Decompresses a string using the ZLib+Base64 algorithm.
 

Detailed Description

Utilities.

Function Documentation

◆ nyx_hash()

uint32_t nyx_hash ( __NYX_ZEROABLE__ size_t  size,
__NYX_NULLABLE__ BUFF_t  buff,
uint32_t  seed 
)

Hashes a buffer using the MurmurHash2 algorithm.

Parameters
sizeSize of the buffer to hash.
buffPointer to the buffer to hash.
seedInitial seed value.
Returns
The computed 32-bit hash.

◆ nyx_generate_mac_addr()

void nyx_generate_mac_addr ( uint8_t  result_mac[6],
uint8_t  mac0,
uint8_t  mac1,
STR_t  node_id 
)

Generates a MAC address based on a node identifier.

Parameters
result_macOutput array to store the generated MAC address.
mac0First fixed byte of the MAC address.
mac1Second fixed byte of the MAC address.
node_idUnique node identifier used to hash the remaining bytes.

Definition at line 14 of file addr.c.

◆ nyx_base64_encode()

__NYX_NULLABLE__ str_t nyx_base64_encode ( __NYX_NULLABLE__ size_t *  result_len,
__NYX_ZEROABLE__ size_t  size,
__NYX_NULLABLE__ BUFF_t  buff 
)

Encodes a buffer using the Base64 algorithm.

Parameters
result_lenOptional pointer to store the length of the encoded string.
sizeSize of the buffer to encode.
buffPointer to the buffer to encode.
Returns
The encoded string.

◆ nyx_base64_decode()

__NYX_NULLABLE__ buff_t nyx_base64_decode ( __NYX_NULLABLE__ size_t *  result_size,
__NYX_ZEROABLE__ size_t  len,
__NYX_NULLABLE__ STR_t  str 
)

Decodes a string using the Base64 algorithm.

Parameters
result_sizeOptional pointer to store the size of the decoded buffer.
lenLength of the string to decode.
strPointer to the string to decode.
Returns
The decoded buffer.

◆ nyx_zlib_deflate()

__NYX_NULLABLE__ buff_t nyx_zlib_deflate ( __NYX_NULLABLE__ size_t *  result_size,
__NYX_ZEROABLE__ size_t  size,
__NYX_NULLABLE__ BUFF_t  buff 
)

Compresses a buffer using the ZLib algorithm.

Parameters
result_sizeOptional pointer to store the size of the compressed buffer.
sizeSize of the buffer to compress.
buffPointer to the buffer to compress.
Returns
The compressed buffer.

◆ nyx_zlib_inflate()

__NYX_NULLABLE__ buff_t nyx_zlib_inflate ( __NYX_NOTNULL__ size_t *  result_size,
__NYX_ZEROABLE__ size_t  size,
__NYX_NULLABLE__ BUFF_t  buff 
)

Decompresses a buffer using the ZLib algorithm.

Parameters
result_sizeMandatory pointer to provide and store the size of the decompressed buffer.
sizeSize of the buffer to decompress.
buffPointer to the buffer to decompress.
Returns
The decompressed buffer.

◆ nyx_zlib_base64_deflate()

__NYX_NULLABLE__ str_t nyx_zlib_base64_deflate ( __NYX_NULLABLE__ size_t *  result_len,
__NYX_ZEROABLE__ size_t  size,
__NYX_NULLABLE__ BUFF_t  buff 
)

Compresses a buffer using the ZLib+Base64 algorithm.

Parameters
result_lenOptional pointer to store the length of the compressed string.
sizeSize of the buffer to compress.
buffPointer to the buffer to compress.
Returns
The compressed string.

◆ nyx_zlib_base64_inflate()

__NYX_NULLABLE__ buff_t nyx_zlib_base64_inflate ( __NYX_NOTNULL__ size_t *  result_size,
__NYX_ZEROABLE__ size_t  len,
__NYX_NULLABLE__ STR_t  str 
)

Decompresses a string using the ZLib+Base64 algorithm.

Parameters
result_sizeMandatory pointer to provide and store the size of the decompressed buffer.
lenLength of the string to decompress.
strPointer to the string to decompress.
Returns
The decompressed buffer.