aliquote.org

March 16, 2019

How about generating figure name using MD5 hash? I’ve long been wondering how to store unique file names for all documents that I happen to write from day to day. The last few years, I decided to prefix all such file names using either fig- or img- depending on the context (i.e., whether it has been generated by a computer program or in the case it’s just an illustration grabed on the internet), followed by a short but meaningful description, e.g. img-emacs-screenshot.png. When it is a series of figures, I usually append an index (“a”, “b”, …; or zero-padded numbers). Still I have lot of duplicates file names on my HD. One way to circumvent this issue is to generate random hash, or I believe so since we all have the md5 utility on Un*x systems. Here we go:

current master ✗ 74db262 22h25m ✖ △ ◒  md5 -s "emacs-screenshot"
MD5 ("emacs-screenshot") = 65c9ef7d939db96dd290adcf9597d65b