![]() The CertUtil is able to perform this function as shown below. Since Windows 2003 there is tool that can be used to calculate SHA256 hashes of a file. Note the use of this library in Python 3.x requires that the string be in byte string format (encoded). Using python from the command line we can generate the SHA256 hash of a string using the hashlib library. 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. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |