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

Functions

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.
 
__NULLABLE__ str_t nyx_base64_encode (__NULLABLE__ size_t *result_len, __ZEROABLE__ size_t size, __NULLABLE__ BUFF_t buff)
 Encodes a buffer to a Base64-encoded string.
 
__NULLABLE__ buff_t nyx_base64_decode (__NULLABLE__ size_t *result_size, __ZEROABLE__ size_t len, __NULLABLE__ STR_t str)
 Decodes a Base64-encoded string to a buffer.
 
uint32_t nyx_hash32 (__ZEROABLE__ size_t size, __NULLABLE__ BUFF_t buff, uint32_t seed)
 Hashes a buffer using the MurmurHash2 algorithm.
 

Detailed Description

Utilities.

Function Documentation

◆ 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.

◆ nyx_base64_encode()

__NULLABLE__ str_t nyx_base64_encode ( __NULLABLE__ size_t * result_len,
__ZEROABLE__ size_t size,
__NULLABLE__ BUFF_t buff )

Encodes a buffer to a Base64-encoded string.

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

◆ nyx_base64_decode()

__NULLABLE__ buff_t nyx_base64_decode ( __NULLABLE__ size_t * result_size,
__ZEROABLE__ size_t len,
__NULLABLE__ STR_t str )

Decodes a Base64-encoded string to a buffer.

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

◆ nyx_hash32()

uint32_t nyx_hash32 ( __ZEROABLE__ size_t size,
__NULLABLE__ BUFF_t buff,
uint32_t seed )

Hashes a buffer using the MurmurHash2 algorithm.

Parameters
sizeInput buffer to hash.
buffLength of the buffer to hash.
seedSeed.
Returns
The computed 32-bit hash.