I'm trying to cache the results of a macro, similar to that question, but the argument of the macro can contain arbitrary characters and it's not suitable to be inside \csname ... \endcsname.
So, I'm wondering: surely some of the TeX core or packages contain functionality to calculate a hash, MD5 or otherwise (I don't really care which). But… I can't find it. The only result I've got from grep'ing my TeXlive tree is pdfmdfivesum, but it only works on files, not strings.
So: are there ready-made hash calculation macros/packages available somewhere?
\pdfmdfivesumsuggests you've looked at using the pdfTeX primitive. It doesn't need a file, it needs<general text>, so seems suitable. However, it's tied to pdfTeX. Is that OK, or do we need a solution for other engines too? (LuaTeX can break out to Lua, XeTeX can't, classical TeX also more tricky.) – Joseph Wright Jun 27 '15 at 18:09