Package 'RcppUUID'

Title: Generating Universally Unique Identificators
Description: Using the efficient implementation in the Boost C++ library, functions are provided to generate vectors of 'Universally Unique Identifiers (UUID)' from R supporting random (version 4), name (version 5) and time (version 7) 'UUIDs'. The initial repository was at <https://gitlab.com/artemklevtsov/rcppuuid>.
Authors: Artem Klevtsov [aut] , Dirk Eddelbuettel [aut, cre]
Maintainer: Dirk Eddelbuettel <[email protected]>
License: GPL (>= 2)
Version: 1.2.0
Built: 2025-02-12 15:24:15 UTC
Source: https://github.com/eddelbuettel/rcppuuid

Help Index


Generating Universally Unique Identificators

Description

Provides functions to generating a vector of Universally Unique Identifiers (UUID) using the implementation from the Boost C++ library. Supports random (version 4), name (version 5) and time-based (version 7) UUIDs. UUIDs generation is parallelized by OpenMP.

Author(s)

Maintainer: Dirk Eddelbuettel [email protected] (ORCID)

Authors:

See Also

Useful links:


Generate UUIDs Version 5

Description

Function generates name-based uuid is derived from content in a namespace. A uuid with identical content shall yield the same uuid. Hashing algorithm is SHA1.

Usage

uuid_generate_name(x, ns = "x500dn")

Arguments

x

Character vector.

ns

Namespace string. Allowed values: dns, url, oid, x500dn.

Value

Character vector with UUIDs.

Note

This function generates valid uuids for the NA and empty strings.

References

https://www.boost.org/doc/libs/1_72_0/libs/uuid/doc/uuid.html#Name%20Generator

Examples

# generate name UUIDs
uuid_generate_name(c("one", "two"))

Generates Nil UUIDs

Description

Function generates nil uuids.

Usage

uuid_generate_nil(n = 1L)

Arguments

n

Number of generated UUIDs.

Value

Character vector with UUIDs.

References

https://www.boost.org/doc/libs/1_72_0/libs/uuid/doc/uuid.html#Nil%20Generator

Examples

# generate nil UUIDs
uuid_generate_nil(2)

Generate UUIDs Version 4

Description

Function generates uuids using operating system provided entropy.

Usage

uuid_generate_random(n = 1L)

Arguments

n

Number of generated UUIDs.

Value

Character vector with UUIDs.

References

https://www.boost.org/doc/libs/1_72_0/libs/uuid/doc/uuid.html#Random%20Generator

Examples

# generate random UUIDs
uuid_generate_random(2)

Generate UUIDs Version 7

Description

This function generates time-based uuids using operating system provided entropy. Note that this requires Boost 1.86 or later.

Usage

uuid_generate_time(n = 1L)

Arguments

n

Number of generated UUIDs.

Value

Character vector with UUIDs generated under specification v7.

References

https://www.boost.org/doc/libs/release/libs/uuid/

Examples

# generate random UUIDs
uuid_generate_time(2)

Validate UUIDs

Description

Function validates uuids.

Usage

uuid_validate(x)

Arguments

x

Character vector.

Value

Logical vector.

Examples

# validate UUIDs
uuid_validate(uuid_generate_random(2))
uuid_validate(uuid_generate_nil(2))
uuid_validate(uuid_generate_name(c("one", "two")))
uuid_validate(c("a", ""))