Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WISH: Built-in MD5 checksum calculator, e.g. tools::md5(x) #21

HenrikBengtsson opened this issue Apr 19, 2016 · 2 comments

WISH: Built-in MD5 checksum calculator, e.g. tools::md5(x) #21

HenrikBengtsson opened this issue Apr 19, 2016 · 2 comments


Copy link


R has a built-in MD5 checksum calculator tools::md5sum(), but it only operates on files. It takes a vector of pathnames (not connections) as input and returns a character string of the same length containing MD5 checksums, e.g.

> files <- dir(R.home(), pattern = "^C", full.names = TRUE)
> files
[1] "C:/PROGRA~1/R/R-3.2.5/CHANGES" "C:/PROGRA~1/R/R-3.2.5/COPYING"
> tools::md5sum(files)
     C:/PROGRA~1/R/R-3.2.5/CHANGES      C:/PROGRA~1/R/R-3.2.5/COPYING
"d45eec95ce49830fdd3277950397dbde" "0cce1e42ef3fb133940946534fcf8896"

Wish / Suggestion

Calculating MD5 checksums is such a common task that it would warrant a core R functions for calculating the checksum for an R object x, e.g. tools::md5(x).

There is an internal src/library/tools/src/md5.c file that implements the MD5 checksum. It even has an internal md5_buffer() function that seems to do exactly this.

See also

  • digest package: Provides well-tested function digest::digest(x, algo="md5") for calculating the MD5 checksum for R object x.
Copy link

luciorq commented Dec 11, 2022

I would love to see an update on that front, is there any way to ping R core members responsible for utils?

Copy link

tdeenes commented Dec 11, 2022

yup, I tried it ~2.5 years ago on r-devel without success... See the convo here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants