Leancrypto 1.7.2
Post-Quantum Cryptographic Library
Functions
lc_uuid.h File Reference
#include "ext_headers.h"
+ Include dependency graph for lc_uuid.h:

Go to the source code of this file.

Functions

void lc_uuid_bin2hex (const uint8_t uuid[16], char uuid_str[37])
 Convert a binary buffer into a UUID. More...
 
int lc_uuid_hex2bin (const char *uuid_str, size_t uuid_strlen, uint8_t uuid[16])
 Convert a UUID into a binary representation. More...
 
int lc_uuid_random (char uuid_str[37])
 Generate random UUID following RFC 4122 section 4.4. More...
 
int lc_uuid_time (char uuid_str[37], uint64_t node)
 Generate time-based UUID following RFC 4122 section 4.2. More...
 

Function Documentation

◆ lc_uuid_bin2hex()

void lc_uuid_bin2hex ( const uint8_t  uuid[16],
char  uuid_str[37] 
)

Convert a binary buffer into a UUID.

Parameters
[in]uuidBinary buffer of 16 bytes
[out]uuid_strNULL-terminated UUID string

◆ lc_uuid_hex2bin()

int lc_uuid_hex2bin ( const char *  uuid_str,
size_t  uuid_strlen,
uint8_t  uuid[16] 
)

Convert a UUID into a binary representation.

Parameters
[in]uuid_strUUID
[in]uuid_strlenLength of UUID buffer (must be at least 36 bytes)
[out]uuidBinary buffer with converted UUID
Returns
0 on success; < 0 on error

◆ lc_uuid_random()

int lc_uuid_random ( char  uuid_str[37])

Generate random UUID following RFC 4122 section 4.4.

Parameters
[out]uuid_strNULL-terminated UUID string
Returns
0 on success; < 0 on error

◆ lc_uuid_time()

int lc_uuid_time ( char  uuid_str[37],
uint64_t  node 
)

Generate time-based UUID following RFC 4122 section 4.2.

Parameters
[out]uuid_strNULL-terminated UUID string
[in]nodenode identifier the UUID applies to
Returns
0 on success; < 0 on error