Switch from sha256sum to sha512sum

Not needed but it will be consistant with the launcher itself
This commit is contained in:
2025-11-03 19:32:19 -07:00
parent 48a7ed545f
commit 9e20d06005
3 changed files with 6 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
use sha2::{Digest, Sha256}; use sha2::{Digest, Sha512};
use std::{ use std::{
fs::{File, create_dir_all}, fs::{File, create_dir_all},
io::{BufReader, copy}, io::{BufReader, copy},
@@ -42,8 +42,8 @@ async fn unzip_to_dir(zip_path: PathBuf, out_dir: PathBuf) -> String {
} }
} }
fn get_sha256_hash(data: &[u8]) -> String { fn get_sha512_hash(data: &[u8]) -> String {
let mut hasher = Sha256::new(); let mut hasher = Sha512::new();
hasher.update(data); hasher.update(data);
let hash = hasher.finalize(); let hash = hasher.finalize();
format!("{:x}", hash) format!("{:x}", hash)
@@ -74,7 +74,7 @@ async fn download(app: AppHandle, url: String, name: String, hash: String) -> St
Err(_) => return "-1".to_string(), Err(_) => return "-1".to_string(),
}; };
let download_hash = get_sha256_hash(&bytes); let download_hash = get_sha512_hash(&bytes);
if hash != download_hash { if hash != download_hash {
return "-2".to_string(); return "-2".to_string();
} }

View File

@@ -111,7 +111,7 @@ export default function Home () {
const findUrl = (plat: string) => { const findUrl = (plat: string) => {
const i = version.platforms.indexOf(plat) const i = version.platforms.indexOf(plat)
return i >= 0 ? version.sha256sums[i] : undefined return i >= 0 ? version.sha512sums[i] : undefined
} }
if (p === 'windows') { if (p === 'windows') {

View File

@@ -3,5 +3,5 @@ export interface LauncherUpdate {
releaseDate: number releaseDate: number
downloadUrls: string[] downloadUrls: string[]
platforms: string[] platforms: string[]
sha256sums: string[] sha512sums: string[]
} }