title: Validate/check file checksum from key in text file using Java
body: <p>I use something like this:</p>
  
  <p><a href="http://www.mkyong.com/java/how-to-generate-a-file-checksum-value-in-java/" rel="nofollow">http://www.mkyong.com/java/how-to-generate-a-file-checksum-value-in-java/</a></p>
  
  <p>to generate a checksum for a file and store the key in a plain txt file.</p>
  
  <p>But how do I go the other way  - match/validate the file checksum with the key in the txt file?</p>
  
  <p>On linux you can do:</p>
  
  <pre><code>sha256sum -c myFile.txt
  </code></pre>
  
  <p>where the myFile.txt contains the SHA and path to the file.</p>
  
  <p>I guess I could just re-compute the checksum and match the value with the value from the file. But is there a less boilerplate way to do this in Java? E.g. simply pass the checksum txt file a MessageDigest like object?</p>