From 6b9ca6a38ce0f0b03db61e7cd4aa019884740e33 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Sat, 20 Jun 2020 09:07:01 -0600 Subject: [PATCH] delete original reference script --- sri.reference.ps1 | 48 ----------------------------------------------- 1 file changed, 48 deletions(-) delete mode 100644 sri.reference.ps1 diff --git a/sri.reference.ps1 b/sri.reference.ps1 deleted file mode 100644 index f2433d0..0000000 --- a/sri.reference.ps1 +++ /dev/null @@ -1,48 +0,0 @@ -param ( - # Specifies a path to one or more locations. - [Parameter(Mandatory=$true, - HelpMessage="Path to resource for which to generate integrity hash.")] - [Alias("path", "resource")] - [ValidateNotNullOrEmpty()] - [string] - $filename, - - [Parameter(HelpMessage="Desired hash algorithm.")] - [Alias("algorithm")] - [ValidateSet('sha256', 'sha384', 'sha512')] - [string] - $hashAlgo='sha384' -) - -function hashSHA($type) { - switch($type) { - 'sha256' { return [System.Security.Cryptography.SHA256]::Create() } - 'sha384' { return [System.Security.Cryptography.SHA384]::Create() } - 'sha512' { return [System.Security.Cryptography.SHA512]::Create() } - default { - Write-Host "`rUnknown hash algorithm.`r" - exit 2 - } - } -} - -$fileContents = Get-Content $filename -Raw -$hashAlgo = $hashAlgo.ToLower() -$hashValue = hashSHA $hashAlgo - -try { - $hashBytes = $hashValue.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($fileContents)) - $hashBase64 = [System.Convert]::ToBase64String($hashBytes) - Write-Host "`r$hashAlgo-$hashBase64`r" -} -catch { - Write-Host "There was a problem generating a hash value." - exit 1 -} -finally { - $hashValue.Dispose() -} - -exit 0 - -#EOF \ No newline at end of file