create_uuid()

create_uuid()#

Generates a cryptographically secure UUID and stores it in the provided buffer.

Prototype

int create_uuid(
    char *bf,
    int   bfsize
);

Parameters

Key

Type

Description

bf

char *

Pointer to a character buffer where the generated UUID will be stored.

bfsize

int

Size of the buffer in bytes; must be at least 37 to accommodate the UUID and null terminator.


Return Value

Returns 0 on success, or -1 if an error occurs (e.g., insufficient buffer size).

Notes

The function generates a UUID using platform-specific secure random number generators. On Linux, it uses getrandom(), while on ESP32, it uses esp_fill_random(). The generated UUID follows the version 4 format.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples