Skip to content

Instantly share code, notes, and snippets.

@demius
Created December 6, 2019 08:47
Show Gist options
  • Save demius/c30edf7634e66b67a9ed825950cfbbb6 to your computer and use it in GitHub Desktop.
Save demius/c30edf7634e66b67a9ed825950cfbbb6 to your computer and use it in GitHub Desktop.
Compute BACPAC hash
$modelXmlPath = Read-Host "model.xml file path"
$hasher = [System.Security.Cryptography.HashAlgorithm]::Create("System.Security.Cryptography.SHA256CryptoServiceProvider")
$fileStream = new-object System.IO.FileStream ` -ArgumentList @($modelXmlPath, [System.IO.FileMode]::Open)
$hash = $hasher.ComputeHash($fileStream)
$hashString = ""
Foreach ($b in $hash) { $hashString += $b.ToString("X2") }
$fileStream.Close()
$hashString
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment