View source: R/lib_data_loader.R
| verify_sha256 | R Documentation |
Computes the SHA256 digest of a file (via the digest package) and compares it to the expected value pinned in provenance.
verify_sha256(path, expected_sha)
path |
Path to the file to hash. |
expected_sha |
The expected SHA256 digest, as a lowercase hex string. |
A list with actual (computed digest), expected (the value
passed in), and match (logical; TRUE if they are identical).
f <- tempfile()
writeLines("hello capsule", f)
# Matching digest -> match TRUE.
chk <- verify_sha256(f, sha256_file(f))
chk$match # TRUE
# A wrong expected digest -> match FALSE, with both values reported.
bad <- verify_sha256(f, "0000000000000000000000000000000000000000000000000000000000000000")
bad$match # FALSE
bad$actual # the real digest
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.