Description
Fast and Vectorized Base32 Encoding.
Description
Fast, dependency free, and vectorized base32 encoding and decoding. 'b32' supports the Crockford, Z, RFC 4648 lower, hex, and lower hex alphabets.
README.md
b32
b32 provides fast, vectorized base32 encoding and decoding with zero dependencies powered by rust 🦀
[!TIP]
Need base64 instead? Check out
{b64}.
Installation
You can install the development version of b32 like so:
pak::pak("extendr/b32")
Example
Encode to base32 using encode():
library(b32)
encoded <- encode(c("Hello", "from", "extendr"))
encoded
#> [1] "91JPRV3F" "CSS6YV8" "CNW78SBECHS0"
Decode using decode_as_string() to get back your original string:
decode_as_string(encoded)
#> [1] "Hello" "from" "extendr"
You can also decode to raw vectors with decode() which returns a "blob" object. The blob package is only a suggested dependency, but if you attach it, its print method will be used:
library(blob)
decode(encoded)
#> <blob[3]>
#> [1] blob[5 B] blob[4 B] blob[7 B]