MyNixOS website logo
Description

Generate and Translate Standard UUIDs.

Generate and translate standard Universally Unique Identifiers (UUIDs) into shorter - or just different - formats and back. Also implements base58 encoders and decoders.

shortuuid

R-CMD-check CRANstatus

The goal of shortuuid is to generate and translate standard UUIDs into shorter - or just different - formats and back. Inspired by short-uuid and a post on fosstodon

Installation

You can install the development version of shortuuid like so:

pak::pak("schochastics/shortuuid")

Example

This package provides functions to generate and convert UUIDs to different formats.

library(shortuuid)
# generate random uuids
ids <- generate_uuid(n = 5)
ids
#> [1] "1fc2d238-b6f2-4959-af5a-ef9950a4141a"
#> [2] "fa49a3f8-1644-4e8b-879c-a68d6292e4e1"
#> [3] "c4109bd3-4d8a-489c-a77a-3a6877ebaab8"
#> [4] "a4f70fce-0469-4044-aa4b-4fdb8ec57281"
#> [5] "e8d5f85c-897e-4911-b2f6-d29f816c6643"
is.uuid(ids)
#> [1] TRUE TRUE TRUE TRUE TRUE

# alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
b58 <- uuid_to_bitcoin58(ids)
b58
#> [1] "4vUZZwaGqmgoLNPrhaZ7JR" "Xuam1xXi4St4kqawLF7mTW" "RDEZPCTUM76cnx3yioKHAX"
#> [4] "MNVfwXsPf2tqwEdFWqqg9N" "VkbFLW53t7FfTRUgVuxMg6"

# alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
f58 <- uuid_to_flickr58(ids)
f58
#> [1] "4VtyyWzgQLFNknoRGzy7iq" "wUzL1XwH4rT4KQzWkf7Lsv" "qdeyocstm76BMX3YHNjhaw"
#> [4] "mnuEWwSoE2TQWeCfvQQF9n" "uKAfkv53T7fEsqtFuUXmF6"
# convert back
bitcoin58_to_uuid(b58)
#> [1] "1fc2d238-b6f2-4959-af5a-ef9950a4141a"
#> [2] "fa49a3f8-1644-4e8b-879c-a68d6292e4e1"
#> [3] "c4109bd3-4d8a-489c-a77a-3a6877ebaab8"
#> [4] "a4f70fce-0469-4044-aa4b-4fdb8ec57281"
#> [5] "e8d5f85c-897e-4911-b2f6-d29f816c6643"
flickr58_to_uuid(f58)
#> [1] "1fc2d238-b6f2-4959-af5a-ef9950a4141a"
#> [2] "fa49a3f8-1644-4e8b-879c-a68d6292e4e1"
#> [3] "c4109bd3-4d8a-489c-a77a-3a6877ebaab8"
#> [4] "a4f70fce-0469-4044-aa4b-4fdb8ec57281"
#> [5] "e8d5f85c-897e-4911-b2f6-d29f816c6643"

Addendum

Code to generate uuids taken from @rkg8

Metadata

Version

0.1.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows