Debian Codegraph @

libuuid/man/uuid_generate.3.adoc

raw
1 //po4a: entry man manual
2 ////
3 Copyright 1999 Andreas Dilger ([email protected])
4
5 %Begin-Header%
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions
8 are met:
9 1. Redistributions of source code must retain the above copyright
10 notice, and the entire permission notice in its entirety,
11 including the disclaimer of warranties.
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
15 3. The name of the author may not be used to endorse or promote
16 products derived from this software without specific prior
17 written permission.
18
19 THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
20 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
22 WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
23 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
25 OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
26 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
29 USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
30 DAMAGE.
31 %End-Header%
32
33 Created Wed Mar 10 17:42:12 1999, Andreas Dilger
34 ////
35 ifdef::neverdefined[---]
36
37 = uuid_generate(3)
38 :doctype: manpage
39 :man manual: Programmer's Manual
40 :man source: util-linux {release-version}
41 :page-layout: base
42 :lib: libuuid
43 :firstversion: 2.15.1
44
45 == NAME
46
47 uuid_generate, uuid_generate_random, uuid_generate_time, uuid_generate_time_safe - create a new unique UUID value
48
49 == SYNOPSIS
50
51 *#include <uuid.h>*
52
53 *void uuid_generate(uuid_t __out__);* +
54 *void uuid_generate_random(uuid_t __out__);* +
55 *void uuid_generate_time(uuid_t __out__);* +
56 *int uuid_generate_time_safe(uuid_t __out__);* +
57 *void uuid_generate_md5(uuid_t __out__, const uuid_t __ns__, const char __*name__, size_t __len__);* +
58 *void uuid_generate_sha1(uuid_t __out__, const uuid_t __ns__, const char __*name__, size_t __len__);*
59
60 == DESCRIPTION
61
62 The *uuid_generate*() function creates a new universally unique identifier (UUID). The uuid will be generated based on high-quality randomness from *getrandom*(2), _/dev/urandom_, or _/dev/random_ if available. If it is not available, then *uuid_generate*() will use an alternative algorithm which uses the current time, the local ethernet MAC address (if available), and random data generated using a pseudo-random generator.
63
64 The *uuid_generate_random*(3) function forces the use of the all-random UUID format, even if a high-quality random number generator is not available, in which case a pseudo-random generator will be substituted. Note that the use of a pseudo-random generator may compromise the uniqueness of UUIDs generated in this fashion.
65
66 The *uuid_generate_time*(3) function forces the use of the alternative algorithm which uses the current time and the local ethernet MAC address (if available). This algorithm used to be the default one used to generate UUIDs, but because of the use of the ethernet MAC address, it can leak information about when and where the UUID was generated. This can cause privacy problems in some applications, so the *uuid_generate*() function only uses this algorithm if a high-quality source of randomness is not available. To guarantee uniqueness of UUIDs generated by concurrently running processes, the uuid library uses a global clock state counter (if the process has permissions to gain exclusive access to this file) and/or the *uuidd*(8) daemon, if it is running already or can be spawned by the process (if installed and the process has enough permissions to run it). If neither of these two synchronization mechanisms can be used, it is theoretically possible that two concurrently running processes obtain the same UUID(s). To tell whether the UUID has been generated in a safe manner, use *uuid_generate_time_safe*(3).
67
68 The *uuid_generate_time_safe*(3) function is similar to *uuid_generate_time*(3), except that it returns a value which denotes whether any of the synchronization mechanisms (see above) has been used.
69
70 The UUID is 16 bytes (128 bits) long, which gives approximately 3.4x10^38 unique values (there are approximately 10^80 elementary particles in the universe according to Carl Sagan's _Cosmos_). The new UUID can reasonably be considered unique among all UUIDs created on the local system, and among UUIDs created on other systems in the past and in the future.
71
72 The *uuid_generate_md5*(3) and *uuid_generate_sha1*(3) functions generate an MD5 and SHA1 hashed (predictable) UUID based on a well-known UUID providing the namespace and an arbitrary binary string. The UUIDs conform to V3 and V5 UUIDs per link:https://tools.ietf.org/html/rfc4122[RFC-4122].
73
74 == RETURN VALUE
75
76 The newly created UUID is returned in the memory location pointed to by _out_. *uuid_generate_time_safe*(3) returns zero if the UUID has been generated in a safe manner, -1 otherwise.
77
78 == CONFORMING TO
79
80 This library generates UUIDs compatible with OSF DCE 1.1, and hash based UUIDs V3 and V5 compatible with link:https://tools.ietf.org/html/rfc4122[RFC-4122].
81
82 == AUTHORS
83
84 Theodore Y. Ts'o
85
86 == SEE ALSO
87
88 *uuidgen*(1),
89 *uuid*(3),
90 *uuid_clear*(3),
91 *uuid_compare*(3),
92 *uuid_copy*(3),
93 *uuid_is_null*(3),
94 *uuid_parse*(3),
95 *uuid_time*(3),
96 *uuid_unparse*(3),
97 *uuidd*(8)
98
99 include::man-common/bugreports.adoc[]
100
101 include::man-common/footer-lib.adoc[]
102
103 ifdef::translation[]
104 include::man-common/translation.adoc[]
105 endif::[]