Suppose I've got a poem.tex source file.
Is there a way to include a hash of the source file as text in the final PDF? I usually use pdflatex
to generate PDF files.
I am looking for something like the result of shasum poem.tex
, looking like this:
c0c0fa9a776ea1891264c884e0e69dbde6142c4a,
being added somewhere to the body of the output file of the pdflatex poem.tex
command.
Is there an easy way to do it?
Best Answer
pdfTeX contains the primitive
\pdfmdfivesum
for this purpose, available in recent XeTeX as\mdfivesum
and implemented in Lua for LuaTeX in thepdftexcmds
package. Using the latter as a wrapper we might haveThe primitive syntax (if we assume pdfTeX/XeTeX):