Encodes a character string, raw vector or other object to base58 encoding with a 4-byte checksum suffix.
Details
Adds a 4-byte checksum suffix (double SHA-256) to the data before base58 encoding. Note: does not include a version byte prefix (unlike Bitcoin Base58Check).
A character string or raw vector (with no attributes) is encoded as is, whilst all other objects are first serialized (using R serialisation version 3, big-endian representation).
References
This implementation is based on 'libbase58' by Luke Dashjr under the MIT licence at https://github.com/luke-jr/libbase58.
Examples
base58enc("secret base")
#> [1] "4EFRHUcj9ookBnv1yX9Gt"
base58enc(as.raw(c(1L, 2L, 4L)), convert = FALSE)
#> [1] 33 44 56 41 66 71 55 64 77
base58enc(data.frame())
#> [1] "Z8bXTedt3w8U2KHiu7WH2MswsjzBGynwW55sFsbxeHE6UhNFc7end5TXRPcQxrkPMcMtPbR7Ncb5eQxnz4c4pHzgD9mtMRgz5aW1q6c2VnCKBrb5hf6YFdkqCN5D1vKBt9HrWb6VnR8UYAmyPFiwVPSGGEWbQ1EdpZX6N5j8sF3vciQ46Wg4zKvu6pRmsXzpVDj9prCwtz"