qq2uu: qq2uu

Description Usage Arguments Value QQIDs Process Endianness Author(s) See Also Examples

View source: R/qq2uu.R

Description

qq2uu converts a vector of QQIDs to UUIDs.

Usage

1
qq2uu(qq)

Arguments

qq

(character) a vector of QQIDs

Value

(character) a vector of UUIDs

QQIDs

QQIDs are specially formatted 128-bit numbers (hexlets), just like UUIDs. See xlt2qq() for the the motivation of mapping UUIDs to QQIDs and details on how QQIDs are structured. qq2uu reverses the mapping exactly to recover the original UUID.

Process

To convert a QQID to a UUID, the two "Q-words" that head the QQID are mapped to their index in the 0:1023 Q-word vector (cf. qMap()), and the indices are converted to two ten bit numbers. These twenty bits are expressed as a five-digit hexadecimal number which replaces the two Q-words to recover the UUID. For details on UUID format see is.xlt(). The remaining 18 Base64 encoded characters are converted to their corresponding 27 hex digits via an intermediate mapping to bit-patterns.

Endianness

The qqid package uses its own functions to convert to and from bits, and is not affected by big-endian vs. little-endian processor architecture or variant byte order. All numbers are interpreted to have their lowest order digits on the right.

Author(s)

(c) 2019 Boris Steipe, licensed under MIT (see file LICENSE in this package).

See Also

xlt2qq() to convert a vector of UUIDs, IPv6 addresses or other hexlets to QQIDs.

Examples

1
2
3
4
5
6
7
8
9
# Convert three example QQIDs and one NA to the corresponding UUIDs
qq2uu( c(QQIDexample(c(1, 3, 5)), NA) )

# forward and back again
myID <- "bird.carp.7TsBWtwqtKAeCTNk8f"
myID == xlt2qq(qq2uu(myID))             # TRUE

# Confirm that example QQID No. 3 is formatted correctly as a UUID
qq2uu( QQIDexample(3) ) == xltIDexample("UUID")  # TRUE

qqid documentation built on May 2, 2019, 12:19 p.m.