title: BASH: Is there a simple way to check whether a string is a valid SHA-1 (or MD5) hash?
body: <p>It's all in the title.</p>
  
  <p>An alternative way to phase the problem is: in BASH, what is a concise way of checking whether a string is a sequence of 40 (or 32) characters in the ranges <code>[0-9]</code> and <code>[a-f]</code>?</p>