Create Compact Hash Digests of R Objects

Implementation of a function 'digest()' for the creation of hash digests of arbitrary R objects (using the 'md5', 'sha-1', 'sha-256', 'crc32', 'xxhash', 'murmurhash', 'spookyhash' and 'blake3' algorithms) permitting easy comparison of R language objects, as well as functions such as'hmac()' to create hash-based message authentication code. Please note that this package is not meant to be deployed for cryptographic purposes for which more comprehensive (and widely tested) libraries such as 'OpenSSL' should be used.

Compact hash representations of arbitrary R objects


The digest package provides a principal function digest() for the creation of hash digests of arbitrary R objects (using the md5, sha-1, sha-256, crc32, xxhash and murmurhash algorithms) permitting easy comparison of R language objects.


As R can serialize any object, we can run digest() on any object:

R> library(digest)
R> digest(trees)
[1] "12412cbfa6629c5c80029209b2717f08"
R> digest(lm(log(Height) ~ log(Girth), data=trees))
[1] "e25b62de327d079b3ccb98f3e96987b1"
R> digest(summary(lm(log(Height) ~ log(Girth), data=trees)))
[1] "86c8c979ee41a09006949e2ad95feb41"

By using the hash sum, which is very likely to be unique, to identify an underlying object or calculation, one can easily caching strategies for which the digest package is somewhat widely used.

Other Functions

A small number of additional functions is available:

  • sha1() for numerally stable hashsums,
  • hmac() for hashed message authentication codes based on a key,
  • AES() for Advanced Encryption Standard block ciphers.


Please note that this package is not meant to be deployed for cryptographic purposes for which more comprehensive (and widely tested) libraries such as OpenSSL should be used.


Dirk Eddelbuettel, with contributions by Antoine Lucas, Jarek Tuszynski, Henrik Bengtsson, Simon Urbanek, Mario Frasca, Bryan Lewis, Murray Stokely, Hannes Muehleisen, Duncan Murdoch, Jim Hester, Wush Wu, Qiang Kou, Thierry Onkelinx, Michel Lang, Viliam Simko, Kurt Hornik and Radford Neal.


GPL (>= 2)


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.6.28 by Dirk Eddelbuettel, a month ago,

Report a bug at

Browse source code at

Authors: Dirk Eddelbuettel <[email protected]> with contributions by Antoine Lucas , Jarek Tuszynski , Henrik Bengtsson , Simon Urbanek , Mario Frasca , Bryan Lewis , Murray Stokely , Hannes Muehleisen , Duncan Murdoch , Jim Hester , Wush Wu , Qiang Kou , Thierry Onkelinx , Michel Lang , Viliam Simko , Kurt Hornik , Radford Neal , Kendon Bell , Matthew de Queljoe , Ion Suruceanu , Bill Denney , Dirk Schumacher , and Winston Chang.

Documentation:   PDF Manual  

GPL (>= 2) license

Imports utils

Suggests tinytest, knitr, rmarkdown, minidown

Imported by ArchaeoPhases, BETS, BatchJobs, BetaBit, BinaryDosage, BuildSys, CorrectOverloadedPeaks, Crossover, DataPackageR, DataSpaceR, EML, FRK, FSelector, FSinR, FeatureHashing, GWSDAT, IRkernel, Knoema, LDATS, LLSR, LSX, MALDIquantForeign, MazamaCoreUtils, MazamaLocationUtils, MonetDB.R, MplusAutomation, NMF, OpasnetUtils, OpenML, OpenMx, OpenSpecy, PKNCA, R.cache, R.filesets, R.rsp, R2MLwiN, ROAuth, RSiteCatalyst, RTTWebClient, Rbitcoin, Rborist, Rexperigen, SGP, SimInf, UCSCXenaTools, UNF, VancouvR, animint2, archivist, archivist.github, ascii, aws.s3, aws.signature, batchtools, baytrends, bdpar, biocompute, bitmexr, blastula, blockmodels, boxr, bsub, cache, calpassapi, cansim, caretEnsemble, connectwidgets, corpustools, covr, crimedata, cronR, crsra, ctmm, dash, datapack, dipsaus, distcomp, distill, distributional, dittodb, dlr, dodgr, downlit, downloader, dparser, dplR, dpmr, drake, duawranglr, easyr, ecd, emayili, ezsim, fbRads, finbif, finch, fulltext, future, galah, geiger, ggmap, ggplot2, ggprism, ggraph, glmbb, googleAuthR, hoardr, htmltools, httpcache, httptest, hunspell, job, kableExtra, knitcitations, kzfs, lintr, listcomp, loose.rock, madrat, memo, memofunc, metR, micemd, miscTools, mleap, mlr3db, mlr3misc, mlr3pipelines, mlr3tuning, mmpca, modelStudio, mulset, mustashe, nat, nat.templatebrains, neurohcp, nlsr, noah, nsrr, odin, onlineforecast, oolong, optmatch, orderly, pander, particles, paws.common, pins, piwikproR, pkgcache, pkgdown, pkgmaker, plotly, pointblank, poio, polished, pomp, portfolioBacktest, prettymapr, progressr, proton, provExplainR, ptvapi, qmethod, r2r, r6extended, radix, rapbase, rayvertex, rbedrock, rbokeh, rcmdcheck, rdhs, rdrop2, rdtLite, reactable, readMzXmlData, readtext, repmis, repo, reproducible, rerddap, rfacts, rfieldclimate, rhub, rim, rmapzen, rmdpartials, rmonad, rms, rmsb, rngtools, routr, roxygen2, rrepast, rsconnect, rsyntax, rtext, rtodoist, sarsop, scatterD3, semtree, sharpshootR, shinycssloaders, shinyjs, shinylogs, shinyservicebot, shinytest, simfinR, simlandr, simpleRCache, sisal, sparklyr, stepR, storr, swirl, tangles, tangram, tarchetypes, targets, tesseract, testthat, text2vec, textrank, textreuse, threeBrain, tidypaleo, tidytransit, trelliscopejs, trustedtimestamping, ubiquity, ufs, vegalite, vegawidget, virtuoso, vtreat, worcs, wordpredictor, wyz.code.rdoc, zooimage.

Depended on by DataEntry, ElstonStewart, ProjectTemplate, RGoogleAnalytics, disordR, gWidgets2, gWidgets2tcltk, gmDatabase, likelihoodAsy, rgdax, rgeoda.

Suggested by ASMap, CUB, FuzzyNumbers, HaDeX, LDAvis, NMproject, R.devices, R.utils, RCBR, REBayes, RxODE, TurtleGraphics, akmedoids, aqp, botor, brms, crosstable, dataone, dataquieR, devtools, dm, enc, ensr, fritools, ggh4x, gtfsrouter, gwsem, hutils, hyperSpec, i2dash, igraph, jointseg, knitr, knitrdata, lfe, lightr, memoise, metadat, mlrCPO, modelsummary, mosmafs, neonstore, nlmixr, openssl, packager, pavo, pkgdepends, provTraceR, rgee, rmarkdown, robustlmm, rotor, rstanarm, rts, sdcTable, sigminer, stars, styler, supreme, swirlify, textmineR.

See at CRAN