jeroen / openssl

OpenSSL bindings for R
Other
63 stars 19 forks source link

coercion to character fails on file hashes? #81

Open cboettig opened 3 years ago

cboettig commented 3 years ago

If I generate a hash like for a file and coerce it to a character, it still doesn't have class character:

hash <- openssl::md5(file(system.file("CITATION")))
x <- as.character(hash)
class(x)

# [1] "hash" "md5" 

This doesn't effect hashes generated from strings. This can obviously create issues downstream, e.g. if I try and serialize the has to JSON:

jsonlite::toJSON(list(hash = x))
Error: No method asJSON S3 class: md5