HenrikBengtsson / Wishlist-for-R

Features and tweaks to R that I and others would love to see - feel free to add yours!
https://github.com/HenrikBengtsson/Wishlist-for-R/issues
GNU Lesser General Public License v3.0
133 stars 4 forks source link

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

Open HenrikBengtsson opened 8 years ago

HenrikBengtsson commented 8 years ago

Background

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

luciorq commented 1 year ago

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

tdeenes commented 1 year ago

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