sha256 | R Documentation |
Wrapper around openssl::sha256()
to make it easy to calculate a checksum of a
file. Converts the returned hash code to a string by default, but can set
as.hash= TRUE
to get the unconverted raw byte based hash object instead.
sha256(file, as.hash = FALSE)
file |
The path to a file to checksum |
as.hash |
Set TRUE to return the hash byte object instead of converting to a string |
Returns the hash as a string, unless as.hash= TRUE is set, in
which case the hash byte object as obtained from openssl::sha256()
is
returned.
aFile <- JefferysRUtils::makeTempFile( c( "one fish", "two fish" ))
aHash <- sha256( aFile )
aHash
#> "a5fb5357754cb5a6ae85090aed325435388c8b0d6e295a058bab55102ffa188e"
aHashObj <- sha256( aFile, as.hash= TRUE )
class(aHashObj)
#> [1] "hash" "sha256"
str(aHashObj)
#> 'hash' raw [1:32] a5 fb 53 57 ...
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.