

The hash function can be performed against any file type not only simple text. Of course getting the SHA256 sum of a file is often used to confirm a files integrity - that two files from different locations or that have been downloaded match. As long as there is no line breaks in the file the hash will match. It is interesting to note that a simple text file with the "password" string matches the hash of the string password. In this example we use bash and the sha256sum utility to generate an SHA256 hash of a file. Using echo -n ensures the line break is not included in the hash generation. Using bash on any Linux command line you can get the SHA256 hash of a string simply by echoing the string to the sha256sum utility.
