switch file hashes from MD5 to SHA256

This commit is contained in:
Benjamin Staneck 2017-04-07 06:57:16 +02:00
parent bee82d00e8
commit aa2eaa6886
2 changed files with 14 additions and 14 deletions

View File

@ -53,6 +53,6 @@ $version = Invoke-Expression "git describe --abbrev=0 --tags"
foreach ($t in $targets.GetEnumerator()) {
Create-Archive $cmderRoot "$saveTo\$($t.Name)" $t.Value
$hash = (Digest-MD5 "$saveTo\$($t.Name)")
$hash = (Digest-Hash "$saveTo\$($t.Name)")
Add-Content "$saveTo\hashes.txt" $hash
}

View File

@ -54,9 +54,9 @@ function Flatten-Directory ($name) {
Remove-Item -Recurse "$($name)_moving"
}
function Digest-MD5 ($path) {
function Digest-Hash($path) {
if(Get-Command Get-FileHash -ErrorAction SilentlyContinue){
return (Get-FileHash -Algorithm MD5 -Path $path).Hash
return (Get-FileHash -Algorithm SHA256 -Path $path).Hash
}
return Invoke-Expression "md5sum $path"
@ -76,7 +76,7 @@ function Register-Cmder(){
$Command = "%V"
, # Defaults to the icons folder in the cmder package.
$icon = (Split-Path $PathToExe | join-path -ChildPath 'icons/cmder.ico')
$icon = (Split-Path $PathToExe | Join-Path -ChildPath 'icons/cmder.ico')
)
Begin
{
@ -124,9 +124,9 @@ function Download-File {
# I think this is the problem
$File = $File -Replace "/", "\"
Write-Verbose "Downloading from $Url to $File"
$wc = new-object System.Net.WebClient
$wc = New-Object System.Net.WebClient
if ($env:https_proxy) {
$wc.proxy = (new-object System.Net.WebProxy($env:https_proxy))
$wc.proxy = (New-Object System.Net.WebProxy($env:https_proxy))
}
$wc.Proxy.Credentials=[System.Net.CredentialCache]::DefaultNetworkCredentials;
$wc.DownloadFile($Url, $File)