github.com/secure-build/gitlab-runner@v12.5.0+incompatible/dockerfiles/build/helpers/checksum.ps1 (about)

     1  param(
     2      [string]$TargetFile,
     3      [string]$ExpectedHash
     4  )
     5  
     6  $hash = Get-FileHash -Path $TargetFile -Algorithm SHA256
     7  
     8  if (-not ($hash.Hash -eq $ExpectedHash)) {
     9      Write-Warning "SHA256 checksum for $TargetFile is invalid"
    10      exit 1
    11  }
    12  
    13  Write-Output "SHA256 checksum for $TargetFile is valid"
    14  exit 0