Last active
September 25, 2019 00:35
-
-
Save MaxAnderson95/ee9a9156d7f16624850177798a720b1e to your computer and use it in GitHub Desktop.
Hashes a directory of files and generates a single SHA1 hash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-FolderHash ($Folder) { | |
Get-ChildItem $folder -Recurse -Exclude "*.psd1" | Where-Object {!$_.psiscontainer} | ForEach-Object {[Byte[]]$contents += [System.IO.File]::ReadAllBytes($_.fullname)} | |
$hasher = [System.Security.Cryptography.SHA1]::Create() | |
[string]::Join("",$($hasher.ComputeHash($contents) | %{"{0:x2}" -f $_})) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment