Skip to content

Commit 49cf435

Browse files
committed
Fix release checksum generation
1 parent 5a90e4b commit 49cf435

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

scripts/release-windows.ps1

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,23 @@ function Invoke-Checked {
1818
}
1919
}
2020

21+
function Get-Sha256Hex {
22+
param(
23+
[Parameter(Mandatory = $true)][string]$Path
24+
)
25+
26+
$Stream = [System.IO.File]::OpenRead($Path)
27+
$Algorithm = [System.Security.Cryptography.SHA256]::Create()
28+
try {
29+
$Bytes = $Algorithm.ComputeHash($Stream)
30+
return ([System.BitConverter]::ToString($Bytes) -replace "-", "").ToLowerInvariant()
31+
}
32+
finally {
33+
$Algorithm.Dispose()
34+
$Stream.Dispose()
35+
}
36+
}
37+
2138
$Package = Get-Content (Join-Path $Root "package.json") -Raw | ConvertFrom-Json
2239
$Version = [string]$Package.version
2340
$Tauri = Get-Content (Join-Path $Root "src-tauri\tauri.conf.json") -Raw | ConvertFrom-Json
@@ -64,8 +81,7 @@ Remove-Item $PortableStage -Recurse -Force
6481

6582
$ChecksumPath = Join-Path $Output "SHA256SUMS.txt"
6683
$Checksums = @($InstallerPath, $PortablePath) | ForEach-Object {
67-
$Hash = Get-FileHash $_ -Algorithm SHA256
68-
"$($Hash.Hash.ToLowerInvariant()) *$([System.IO.Path]::GetFileName($_))"
84+
"$(Get-Sha256Hex $_) *$([System.IO.Path]::GetFileName($_))"
6985
}
7086
$Checksums | Set-Content $ChecksumPath -Encoding ascii
7187

0 commit comments

Comments
 (0)