diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/fetchDependency.ps1 | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index d2e2b89fd..e8c66c84d 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -194,17 +194,17 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) performDownload $Dependency $url $downloadsDir $downloadPath $downloadVersion $requiredVersion #calculating the hash - if ($PSVersionTable.PSEdition -ne "Core") + if (Test-Command -commandName 'Get-FileHash') + { + $downloadedFileHash = (Get-FileHash -Path $downloadPath -Algorithm SHA256).Hash + } + else { $hashAlgorithm = [Security.Cryptography.HashAlgorithm]::Create("SHA256") $fileAsByteArray = [io.File]::ReadAllBytes($downloadPath) $hashByteArray = $hashAlgorithm.ComputeHash($fileAsByteArray) $downloadedFileHash = -Join ($hashByteArray | ForEach-Object {"{0:x2}" -f $_}) } - else - { - $downloadedFileHash = (Get-FileHash -Path $downloadPath -Algorithm SHA256).Hash - } if ($expectedDownloadedFileHash -ne $downloadedFileHash) { |
