Posted On February 4, 2020

PowerShell: An Exercise in Calculating Checksums

kimconnect 0 comments
blog.KimConnect.com >> Codes >> 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 *

Related Post

A Few Todos while Securing Apache Server

- Install mod_security - Set expose_php = Off in php.ini - Set SecResponseBodyAccess Off in…

PowerShell: Find Guest VMs Associated with a Certain Storage Path

# findGuestMvsByStorage.ps1 $storagePath='\\SMBSERVER009' function getAllGuestVms($clusterName){ try{ Import-Module FailoverClusters $clusterName=if($clusterName){ $clustername }else{ (get-cluster).name } $allHyperVHosts={(Get-ClusterNode -Cluster…

An Exercise in Discover Whether an Active Directory Account Has RDP Access to Windows Bastion Hosts

Check Computers: $computernames='RDPSERVER01','RDPSERVER02','RDPSERVER03' invoke-command -computername $computernames {get-localgroupmember 'remote desktop users'}|select PSComputername,Name # Sample output PS…