This PowerShell script outputs the hash of a given file using the same algorithm as the GIANTS getFileMD5() function.
.\getFileMD5.ps1 <FilePath> [<CustomBaseName>] [-Debug]<FilePath>: The path to the file to hash.<CustomBaseName>: Optional. A custom base name to use instead of the file base name.-Debug: Optional. Enable debug information output.
The algorithm is as follows:
- Read the contents of the file.
- Concatenate the file contents with the derived or provided base name (file name without extension).
- Compute the MD5 hash of the concatenated data.
.\getFileMD5.ps1 'file.zip'.\getFileMD5.ps1 'file.zip' 'My_Base_Name'.\getFileMD5.ps1 'file.zip' -Debug.\getFileMD5.ps1 'file.zip' 'My_Base_Name' -Debug.\getFileMD5.ps1 'C:\path\to\your\file.zip'.\getFileMD5.ps1 'C:\path\to\your\file.zip' 'My_Base_Name'.\getFileMD5.ps1 'C:\path\to\your\file.zip' -Debug.\getFileMD5.ps1 'C:\path\to\your\file.zip' 'My_Base_Name' -Debug