cryptography - Hash value MD5 and SHA256 of file is coming different when file is from system32 folder. Why? -


i calculated md5 , sha256 hash values of notepad.exe , mspaint.exe through online hash generators md5filecalculator onlinemd5. noticed if calculate when both exe's present in actual postion in system32 value coming different when placed somewhere out of system32 folder. reason behind ? correct hash value ?

i using software restriction policy block applications, created hash rule notepad.exe(present in syste32 folder) file , blocked it. when check hash value in registry different hash value of notepad.exe (from system32 folder) calculated through other methods online md5 calculators or through windows api. when copy notepad.exe file other folder on desktop , calculate hash value, coming same in registry created rule.so correct value think 1 when file out of system32 folder. not getting why happening ? have permissions ?

it's because of 32-bit applications running on 64-bit windows, , how windows handles system32 folder programs.

this driving me nuts while because couldn't life of me figure out why files in system32 (namely .dlls , .exes) returning different hashes depending on checked them with.

using hxd , firefox upload file check hash, got different results compared using qttabbar's hash checker, runs inside explorer.exe.

but if copied 1 of these files location, identical results across programs.

meanwhile, hxd showed different file lengths copied file vs 1 in system32, , while both showed similar byte distribution, there significant differences.

but thought try same thing on folder, , cracked it, little wikipedia:

the operating system uses %systemroot%\system32 directory 64-bit library , executable files. done backward compatibility reasons, many legacy applications hardcoded use path. when executing 32-bit applications, wow64 transparently redirects 32-bit dlls %systemroot%\syswow64, contains 32-bit libraries , executables.

32-bit applications not aware running on 64-bit operating system. 32-bit applications can access %systemroot%\system32 through pseudo directory %systemroot%\sysnative.

because hxd , firefox (and other browsers) 32-bit applications, when load file them, windows transparently redirecting them file of same name in syswow64 folder (presumably if ran 64-bit browser, not encounter problem).

similarly, when copy file out of system32 location, explorer.exe, being 64-bit process, copies original system32 file, , not (confusingly named) syswow64 equivalent.

so wiki states, if enter %systemroot%\sysnative path of open file dialogue in 32-bit application, should load file real system32 folder, , give correct result.

and if check files in syswow64 directory, files should return same respective hashes regardless of open them with.

further reading:


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -