nanoid(3) Library Functions Manual nanoid(3)

nanoidgenerate a Nano ID

#include <nanoid.h>

NANOID();

char *
nanoid(size_t length);

() generates a Nano ID of the default length. Expands to (21).

nanoid() generates a Nano ID of the given length ≤256. Returns a newly allocated null-terminated string with the ID, or NULL if calloc(3) or getentropy(3) fail.

Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.

nanoidgen(1)

Luka Teras <luka@sdf.org>

December 8, 2024