patch hash check
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user