| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 28fc24e commit 1ee0bb8
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -193,43 +193,52 @@ The :mod:`uuid` module defines the following functions: | |||
| 193 | 193 | ||
| 194 | 194 | .. function:: uuid1(node=None, clock_seq=None) | |
| 195 | 195 | ||
| 196 | - Generate a UUID from a host ID, sequence number, and the current time. If *node* | ||
| 197 | - is not given, :func:`getnode` is used to obtain the hardware address. If | ||
| 198 | - *clock_seq* is given, it is used as the sequence number; otherwise a random | ||
| 199 | - 14-bit sequence number is chosen. | ||
| 196 | + Generate a UUID from a host ID, sequence number, and the current time | ||
| 197 | + according to :rfc:`RFC 9562, §5.1 <9562#section-5.1>`. | ||
| 198 | + | ||
| 199 | + When *node* is not specified, :func:`getnode` is used to obtain the hardware | ||
| 200 | + address as a 48-bit positive integer. When a sequence number *clock_seq* is | ||
| 201 | + not specified, a pseudo-random 14-bit positive integer is generated. | ||
| 202 | + | ||
| 203 | + If *node* or *clock_seq* exceed their expected bit count, | ||
| 204 | + only their least significant bits are kept. | ||
| 200 | 205 | ||
| 201 | 206 | ||
| 202 | 207 | .. function:: uuid3(namespace, name) | |
| 203 | 208 | ||
| 204 | 209 | Generate a UUID based on the MD5 hash of a namespace identifier (which is a | |
| 205 | 210 | UUID) and a name (which is a :class:`bytes` object or a string | |
| 206 | - that will be encoded using UTF-8). | ||
| 211 | + that will be encoded using UTF-8) | ||
| 212 | + according to :rfc:`RFC 9562, §5.3 <9562#section-5.3>`. | ||
| 207 | 213 | ||
| 208 | 214 | ||
| 209 | 215 | .. function:: uuid4() | |
| 210 | 216 | ||
| 211 | - Generate a random UUID. | ||
| 217 | + Generate a random UUID in a cryptographically-secure method | ||
| 218 | + according to :rfc:`RFC 9562, §5.4 <9562#section-5.4>`. | ||
| 212 | 219 | ||
| 213 | 220 | ||
| 214 | 221 | .. function:: uuid5(namespace, name) | |
| 215 | 222 | ||
| 216 | 223 | Generate a UUID based on the SHA-1 hash of a namespace identifier (which is a | |
| 217 | 224 | UUID) and a name (which is a :class:`bytes` object or a string | |
| 218 | - that will be encoded using UTF-8). | ||
| 225 | + that will be encoded using UTF-8) | ||
| 226 | + according to :rfc:`RFC 9562, §5.5 <9562#section-5.5>`. | ||
| 219 | 227 | ||
| 220 | 228 | ||
| 221 | 229 | .. function:: uuid6(node=None, clock_seq=None) | |
| 222 | 230 | ||
| 223 | 231 | Generate a UUID from a sequence number and the current time according to | |
| 224 | - :rfc:`9562`. | ||
| 232 | + :rfc:`RFC 9562, §5.6 <9562#section-5.6>`. | ||
| 233 | + | ||
| 225 | 234 | This is an alternative to :func:`uuid1` to improve database locality. | |
| 226 | 235 | ||
| 227 | 236 | When *node* is not specified, :func:`getnode` is used to obtain the hardware | |
| 228 | 237 | address as a 48-bit positive integer. When a sequence number *clock_seq* is | |
| 229 | 238 | not specified, a pseudo-random 14-bit positive integer is generated. | |
| 230 | 239 | ||
| 231 | - If *node* or *clock_seq* exceed their expected bit count, only their least | ||
| 232 | - significant bits are kept. | ||
| 240 | + If *node* or *clock_seq* exceed their expected bit count, | ||
| 241 | + only their least significant bits are kept. | ||
| 233 | 242 | ||
| 234 | 243 | .. versionadded:: 3.14 | |
| 235 | 244 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments