Generates hashes with or without an extra key/salt. This key defaults to the project identifier.
generate_hash(x, key = TRUE, bits = 256)input, will be converted to character
key or salt. Use TRUE (default) to use the project identifier that will be printed to the Console, or any character to use as key/salt, or use NULL or FALSE to not use a key.
number of bits, often one of: 224, 256, 384, 512
This function uses the openssl::sha2() function for the hashing, but always returns a character vector.
generate_hash("a")
#> Using {certeprojects} project identifier as hash key: "runner-2610011409".
#> [1] "d5877ff8bdd40957370cb74db4f0e5a3ef72b3f9c3a5095384d5ddb593808c00"
generate_hash(c("a", "b", "c"))
#> Using {certeprojects} project identifier as hash key: "runner-2610011409".
#> [1] "d5877ff8bdd40957370cb74db4f0e5a3ef72b3f9c3a5095384d5ddb593808c00"
#> [2] "4b9f6b68ac951abb831001688a156173870ca70324e88275677bae6597205d32"
#> [3] "bb97b3e7b913627f0315eeb700c5ec68be298cca1df84aa79470d734039d7766"
generate_hash("a", "secret")
#> [1] "4048c44911916043ff626895ff78c5262764685b6cb9a03ce07886a9effb924c"
generate_hash(c("a", "b", "c"), "secret")
#> [1] "4048c44911916043ff626895ff78c5262764685b6cb9a03ce07886a9effb924c"
#> [2] "8caf295837e09c876c0c5ef729581d5e75ef93adc10420ce71aab05636ac63ed"
#> [3] "ef006b65b8ce49c891479554278e47e7d76735e7ddd6392fc68342322f39e3c4"