patch hash check

This commit is contained in:
2025-10-17 12:53:20 +03:00
parent 561400ae3c
commit ac8b4d6f81
4 changed files with 32 additions and 17 deletions

View File

@@ -1,3 +1,4 @@
use md5;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::{fs, io};
@@ -9,7 +10,7 @@ pub struct Zsdiff {
}
impl Zsdiff {
pub async fn from_vec(_data: Vec<Vec<u8>>) -> Result<Self, std::io::Error> {
pub async fn from_vec(_data: Vec<Vec<u8>>) -> Result<Self, io::Error> {
let mut content = HashMap::new();
for part in _data {
let filename_size = u32::from_be_bytes(part[0..4].try_into().unwrap()) as usize;
@@ -56,7 +57,7 @@ pub struct Metadata {
pub remove_files: Vec<String>,
}
pub async fn get_hash(data: &Vec<u8>) -> String {
pub async fn get_hash(data: Vec<u8>) -> String {
let hash = md5::compute(&data[..]);
format!("{:x}", hash)
}