×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ, Entry ID: 109483101, Entry date: 10/05/2016
(24)
Rate

How do you determine the SHA-256 checksum of a file?

  • Entry
  • Associated product(s)
To check the integrity of a file you can use mathematical procedures to create a hash value (checksum) of the file.

Initial situation
You have downloaded a file from Online Support and would like to check the integrity of the data. You know the SHA-256 hash value of the downloaded file.

Instructions
You can use different tools and programs to determine the SHA-256 hash value of a file.
But Windows (version 7 SP1 and higher) also provides the possibility of determining the hash value; for this you need the Windows Powershell V4.0 or higher (see Notes):
To have the SHA256 hash value of a file calculated you enter the following command in the input prompt: powershell get-filehash -algorithm sha256 'file name'

Example:
 


In order to make it easier to calculate the hash value you can download the following batch file. You then drag-and-drop the file to be checked to this batch file (or to a link). The hash value is then displayed in the Windows editor:

Registration required 109483101_Hash_FileToTxt.zip (1 KB)
SHA256: C724B40B61DDA1B8E43D8787D3BE7C77B81FFB9E4CBF6FC4CB1CCF13E736D466

Notes

Setting the window size for the input prompt
In the default settings the width of the input prompt is often too narrow (80 characters) so that the SHA256 hash value or the file name might be truncated with three periods. You then have to change the settings once:

  • Press the key combination <Win><R> to open the "Run" dialog and there you enter CMD .

  • Click the "C:\" icon in the title bar of the CMD window and select the properties >Layout>Width. There you enter a new width of about 160 and click OK.

  • Close the CMD window by entering EXIT and pressing Enter.


Determining the installed Powershell version
Press the key combination <Win><R> and enter Powershell. Enter $PSVersionTable :



Under "PSVersion" you can read the version of the Powershell.
You need at least version V4.0 for calculating the SHA256 hash value.

Updating the Powershell
The Powershell is included in the Windows Management Framework (WMF) which you can download directly from Microsoft.
For this you search for "download wmf" on the international Microsoft website.
https://msdn.microsoft.com/en-us/powershell/wmf/5.1/install-configure.

SHA-512
If you want to check SHA-512, you have to use the following command:
powershell get-filehash -algorithm sha512 'File name'


Additional Keywords
sha256, sha512, Checksum

Security information
In order to protect plants, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art industrial security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about industrial security, please visit
http://www.siemens.com/industrialsecurity.