Leancrypto 1.7.2
Post-Quantum Cryptographic Library
lc_uuid.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2026, Stephan Mueller <smueller@chronox.de>
3 *
4 * License: see LICENSE file in root directory
5 *
6 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
7 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
8 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
9 * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
10 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
11 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
12 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
13 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
14 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
15 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
16 * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
17 * DAMAGE.
18 */
19
20#ifndef LC_UUID_H
21#define LC_UUID_H
22
23#include "ext_headers.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
35void lc_uuid_bin2hex(const uint8_t uuid[16], char uuid_str[37]);
36
46int lc_uuid_hex2bin(const char *uuid_str, size_t uuid_strlen, uint8_t uuid[16]);
47
55int lc_uuid_random(char uuid_str[37]);
56
65int lc_uuid_time(char uuid_str[37], uint64_t node);
66
67#ifdef __cplusplus
68}
69#endif
70
71#endif /* LC_UUID_H */
int lc_uuid_hex2bin(const char *uuid_str, size_t uuid_strlen, uint8_t uuid[16])
Convert a UUID into a binary representation.
void lc_uuid_bin2hex(const uint8_t uuid[16], char uuid_str[37])
Convert a binary buffer into a UUID.
int lc_uuid_time(char uuid_str[37], uint64_t node)
Generate time-based UUID following RFC 4122 section 4.2.
int lc_uuid_random(char uuid_str[37])
Generate random UUID following RFC 4122 section 4.4.