Home

Awesome

Project Status: Active – The project has reached a stable, usable
state and is being actively
developed. Signed
by Signed commit
% R-CMD-check Linux build
Status Coverage
Status Minimal R
Version License

nanoid

Tools to Generate Short, Secure, URL-friendly, and Unique String Identifiers

Description

Nano IDs are comparable to UUID v4 (random-based). They have a similar number of random bits in the ID (126 in Nano ID and 122 in UUID), so they have similar collision probabilities. Nano ID also use a bigger alphabet, so a similar number of random bits are packed in just 21 symbols instead of 36. The C++ code implements the algorithm specified by Andrey Sitnik.

What’s Inside The Tin

The following functions are implemented:

Installation

remotes::install_github("hrbrmstr/nanoid")

NOTE: To use the ‘remotes’ install options you will need to have the {remotes} package installed.

Usage

library(nanoid)

# current version
packageVersion("nanoid")
## [1] '0.1.0'
NANOIDgenerate()
## [1] "9LlXQv_BHj1X1ZfntGFtR"

NANOIDgenerate(alphabet = nanoid_dict[["numbers"]])
## [1] "044406255383489412581"

NANOIDgenerate(alphabet = nanoid_dict[["lowercase"]])
## [1] "ebralaoqxsronwgxxwjzo"

NANOIDgenerate(alphabet = nanoid_dict[["uppercase"]])
## [1] "PPHHWIKVLYTGYINLWWFJF"

NANOIDgenerate(alphabet = nanoid_dict[["hexadecimal_lowercase"]])
## [1] "5aa442ce40d4d2fb0ec0b"

NANOIDgenerate(alphabet = nanoid_dict[["hexadecimal_uppercase"]])
## [1] "A21422FADEE86B009C58F"

NANOIDgenerate(alphabet = nanoid_dict[["nolookalikes"]])
## [1] "TRw9titDkQbmqa6kMicUf"

NANOIDgenerate(alphabet = nanoid_dict[["nolookalikes_safe"]])
## [1] "pJKB7wLwHBQmQh88WBjNr"

NANOIDgenerate(alphabet = nanoid_dict[["alphanumeric"]])
## [1] "dUxcl5Jqzn2Da698lOpYL"
NANOIDgenerate(size = 10)
## [1] "HpyTj2WrPb"

NANOIDgenerate(size = 10, alphabet = nanoid_dict[["numbers"]])
## [1] "2985374791"

NANOIDgenerate(size = 10, alphabet = nanoid_dict[["lowercase"]])
## [1] "okqesasdcx"

NANOIDgenerate(size = 10, alphabet = nanoid_dict[["uppercase"]])
## [1] "YYXUVJJHHZ"

NANOIDgenerate(size = 10, alphabet = nanoid_dict[["hexadecimal_lowercase"]])
## [1] "1ca95c6ad1"

NANOIDgenerate(size = 10, alphabet = nanoid_dict[["hexadecimal_uppercase"]])
## [1] "63CB499F3A"

NANOIDgenerate(size = 10, alphabet = nanoid_dict[["nolookalikes"]])
## [1] "KddaNenDFB"

NANOIDgenerate(size = 10, alphabet = nanoid_dict[["nolookalikes_safe"]])
## [1] "GMBfRQ9WJ9"

NANOIDgenerate(size = 10, alphabet = nanoid_dict[["alphanumeric"]])
## [1] "XGXZPkbmjt"

nanoid Metrics

Lang# Files(%)LoC(%)Blank lines(%)# Lines(%)
C++40.131210.21290.15370.10
C/C++ Header30.10760.13160.09690.18
YAML20.07350.06100.0520.01
R50.17260.0560.03490.13
Rmd10.03260.05330.18320.08
SUM150.502840.50940.501890.50

clock Package Metrics for nanoid

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.