PowerShell: An Exercise in Calculating Checksums

$out = new-object byte[] 1073741824; #1GB
(new-object Random).NextBytes($out);
[IO.File]::WriteAllBytes($dummyFile, $out);

Measure-command{$hash=jacksum -a crc8 -x $dummyFile}
write-host $hash

# New Server
PS C:\Windows\system32> measure-command{$hash=jacksum -a crc8 -x $dummyFile}
Days : 0
Hours : 0
Minutes : 0
Seconds : 4
Milliseconds : 140
Ticks : 41406433
TotalDays : 4.79241122685185E-05
TotalHours : 0.00115017869444444
TotalMinutes : 0.0690107216666667
TotalSeconds : 4.1406433
TotalMilliseconds : 4140.6433
PS C:\Windows\system32> write-host $hash
eb 1073741824 D:\Test\dummyFile.txt

# Old Server
Days : 0
Hours : 0
Minutes : 0
Seconds : 3
Milliseconds : 725
Ticks : 37256354
TotalDays : 4.31207800925926E-05
TotalHours : 0.00103489872222222
TotalMinutes : 0.0620939233333333
TotalSeconds : 3.7256354
TotalMilliseconds : 3725.6354
PS C:\Users\176233> write-host $hash
a3 1073741824 E:\Test\dummyFile.txt

Leave a Reply

Your email address will not be published. Required fields are marked *