diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index fa23a21..5448364 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,4 +1,4 @@ -use sha2::{Digest, Sha256}; +use sha2::{Digest, Sha512}; use std::{ fs::{File, create_dir_all}, 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 { - let mut hasher = Sha256::new(); +fn get_sha512_hash(data: &[u8]) -> String { + let mut hasher = Sha512::new(); hasher.update(data); let hash = hasher.finalize(); format!("{:x}", hash) @@ -74,7 +74,7 @@ async fn download(app: AppHandle, url: String, name: String, hash: String) -> St Err(_) => return "-1".to_string(), }; - let download_hash = get_sha256_hash(&bytes); + let download_hash = get_sha512_hash(&bytes); if hash != download_hash { return "-2".to_string(); } diff --git a/src/app/page.tsx b/src/app/page.tsx index 81884b1..76f94db 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -111,7 +111,7 @@ export default function Home () { const findUrl = (plat: string) => { const i = version.platforms.indexOf(plat) - return i >= 0 ? version.sha256sums[i] : undefined + return i >= 0 ? version.sha512sums[i] : undefined } if (p === 'windows') { diff --git a/src/app/types/LauncherUpdate.ts b/src/app/types/LauncherUpdate.ts index f7b6b54..e7b75f2 100644 --- a/src/app/types/LauncherUpdate.ts +++ b/src/app/types/LauncherUpdate.ts @@ -3,5 +3,5 @@ export interface LauncherUpdate { releaseDate: number downloadUrls: string[] platforms: string[] - sha256sums: string[] + sha512sums: string[] } \ No newline at end of file