lib/mixlib/install/generator/powershell/scripts/helpers.ps1 in mixlib-install-1.0.3 vs lib/mixlib/install/generator/powershell/scripts/helpers.ps1 in mixlib-install-1.0.4
- old
+ new
@@ -58,10 +58,10 @@
function disposable($o){($o -is [IDisposable]) -and (($o | get-member | foreach-object {$_.name}) -contains 'Dispose')}
function use($obj, [scriptblock]$sb){try {& $sb} catch [exception]{throw $_} finally {if (disposable $obj) {$obj.Dispose()}} }
function Get-FileHash ($Path, $Algorithm) {
$Path = (resolve-path $path).providerpath
$hash = @{Algorithm = $Algorithm; Path = $Path}
- use ($c = New-Object -TypeName Security.Cryptography.SHA256CryptoServiceProvider) {
+ use ($c = New-Object -TypeName Security.Cryptography.SHA256Managed) {
use ($in = (gi $path).OpenRead()) {
$hash.Hash = ([BitConverter]::ToString($c.ComputeHash($in))).Replace("-", "").ToUpper()
}
}
new-object PSObject -Property $hash