Search code examples
cmdhashsha256

CMD CertUtil -hashfile producing segmented instead of continuous strings


In my batch file I run the below command:

CertUtil -hashfile SomeFile.txt sha256 | findstr /v "hash"

When I run this on my local environment it produces an output such as "8bf5d1b671bf44ebf72e7fc3dcc40d2190543b3bae2a653e1e64d2755dac12cc".

However when I run this on one of my servers using the same command, I get a segmented output instead such as "8b f5 d1 b6 71 bf 44 eb f7 2e 7f c3 dc c4 0d 21 90 54 3b 3b ae 2a 65 3e 1e 64 d2 75 5d ac 12 cc".

The commands I am using are the same and I'm unaware of any elements that are causing the output to look as such. Is there something I'm missing that's causing windows to produce the string above?


Solution

  • Version differences, as explained in comments by Compo above here, attribute to the differences in output between CertUtil in my local and remote servers. @Compo has provided a script to produce the format that coverts between the versions and has solved the issue.