A small class implementing the SHA1 hashing algorithm.
SHA (Secure Hash Algorithm) is a cryptographically safe function developed by NIST and NSA in 1992. It fulfills all the requirements imposed for one-way hashing functions and it generates very different images for similar sequences. This code is based on the 100% free public domain implementation by Dominik Reichl.
NO WARRANTY is given for this code. Use it at your own risk. It should always compute correct SHA1 digests, but no security-related tests have been made.
Compute SHA1 hash for a file or byte array:
Everything is static, so you don't need to instantiate any class.
If you are handling sensitive data you may want to "clean" used variables before leaving the hashFile() method, so simply remove the comments at the end of the method.