SHA 265 hashing two documents

Nick Schiffers 0 Reputation points
2023-03-14T14:46:39.08+00:00

I have the following question. I want to compare two Excel document on their content. So I want to use the following code in PowerShell: Get-filehash -Algorithm SHA256 -Path......

When I create two different documents with the same content I get two different hash code. How is that possible? I always thought if the content is completely the same I need to get the same code.

Does anyone have an anwser who this is possible?

And does anyone have a solution how I can compare two Excel documents with hashing?

Microsoft 365 and Office | Excel | For business | Windows
Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rich Matheisen 47,901 Reputation points
    2023-03-14T15:35:52.08+00:00

    An Excel file isn't a simple string of characters. If you save a file in XLSX format it's really compressed archive. If any one of the files within that archive has a different bit of data the files' hash will differ.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.