OpenBSD manual page server

Manual Page Search Parameters

IDGEN32(9) Kernel Developer's Manual IDGEN32(9)

idgen32, idgen32_initnon-repeating ID generation

#include <crypto/idgen.h>

idgen32_init(struct idgen32_ctx *ctx);

idgen32(struct idgen32_ctx *ctx);

The () functions provide a facility to generate a stream of 32-bit numbers that are strongly unpredictable and have a repetition cycle close to 2^32. Such numbers are useful as protocol identifiers where there are negative consequences to reusing an ID within a short time period, as may happen if they are simply assigned at random.

The () function prepares a context structure for use.

The () function returns a new ID in host byte order. Note that this function will never return 0 as it often has a special meaning in network protocols.


The idgen32 functions were added in OpenBSD 4.4.

November 23, 2015 OpenBSD-current