]> git.ipfire.org Git - thirdparty/util-linux.git/blame - libuuid/man/uuid_generate.3.adoc
build-sys: make man pages location independent
[thirdparty/util-linux.git] / libuuid / man / uuid_generate.3.adoc
CommitLineData
295b3979 1//po4a: entry man manual
056fc174
MB
2////
3Copyright 1999 Andreas Dilger (adilger@enel.ucalgary.ca)
4
5%Begin-Header%
6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions
8are met:
91. 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.
122. 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.
153. 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
19THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
20WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
22WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
23LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
25OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
26BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
29USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
30DAMAGE.
31%End-Header%
32
33Created Wed Mar 10 17:42:12 1999, Andreas Dilger
34////
35= uuid_generate(3)
36:doctype: manpage
37:man manual: Programmer's Manual
38:man source: util-linux {release-version}
39:page-layout: base
40:lib: libuuid
41:firstversion: 2.15.1
42
43== NAME
44
45uuid_generate, uuid_generate_random, uuid_generate_time, uuid_generate_time_safe - create a new unique UUID value
46
47== SYNOPSIS
48
49*#include <uuid.h>*
50
51*void uuid_generate(uuid_t __out__);* +
52*void uuid_generate_random(uuid_t __out__);* +
53*void uuid_generate_time(uuid_t __out__);* +
54*int uuid_generate_time_safe(uuid_t __out__);* +
55*void uuid_generate_md5(uuid_t __out__, const uuid_t __ns__, const char __*name__, size_t __len__);* +
56*void uuid_generate_sha1(uuid_t __out__, const uuid_t __ns__, const char __*name__, size_t __len__);*
57
58== DESCRIPTION
59
60The *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.
61
62The *uuid_generate_random*() 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.
63
64The *uuid_generate_time*() 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* 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*.
65
66The *uuid_generate_time_safe*() function is similar to *uuid_generate_time*(), except that it returns a value which denotes whether any of the synchronization mechanisms (see above) has been used.
67
68The 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.
69
70The *uuid_generate_md5*() and *uuid_generate_sha1*() 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].
71
72== RETURN VALUE
73
74The newly created UUID is returned in the memory location pointed to by _out_. *uuid_generate_time_safe*() returns zero if the UUID has been generated in a safe manner, -1 otherwise.
75
76== CONFORMING TO
77
78This 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].
79
80== AUTHORS
81
82Theodore Y. Ts'o
83
84== SEE ALSO
85
86*uuidgen*(1),
87*uuid*(3),
88*uuid_clear*(3),
89*uuid_compare*(3),
90*uuid_copy*(3),
91*uuid_is_null*(3),
92*uuid_parse*(3),
93*uuid_time*(3),
94*uuid_unparse*(3),
95*uuidd*(8)
96
625e9c61 97include::man-common/bugreports.adoc[]
056fc174 98
625e9c61 99include::man-common/footer-lib.adoc[]
056fc174
MB
100
101ifdef::translation[]
625e9c61 102include::man-common/translation.adoc[]
056fc174 103endif::[]