Calculating checksums are perhaps not the first thing you would think of needing to do in PowerShell. But if you ever are in a situation that you need to calculate a checksum using the CRC32 algorithm, I got you covered with this small function.
I can’t take full credit for the code itself, all I did was converting the code from C to PowerShell.
[System.Text.Encoding]::ASCII.GetBytes("PowerShell") | Get-CRC32
This will give you the CRC32 checksum of 2730794414, which is an INT64. If you want to convert it to HEX, you can do the following:
This will give you the HEX value of a2c49dae.
The function takes a byte array as input, which is the reason I had to convert the string in the example above.
Here is the function it self, with another example included: