Skip to content

Commit

Permalink
Fixed hash calculation of logical files.
Browse files Browse the repository at this point in the history
  • Loading branch information
ph0llux committed Jul 29, 2024
1 parent 1e9d43b commit 854fc72
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
14 changes: 5 additions & 9 deletions src/lib/file/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,18 +263,14 @@ impl FileEncoder {

self.acquisition_end = OffsetDateTime::from(SystemTime::now()).unix_timestamp() as u64;
let mut hash_values = Vec::new();
for (hash_type, hash) in encoding_thread_pool_manager.finalize_all_hashing_threads() {
for (hash_type, hash) in encoding_thread_pool_manager.finalize_all_hashing_threads() {
let mut hash_value = HashValue::new_empty(hash_type.clone());
hash_value.set_hash(hash.to_vec());
for (hash_type, hash) in encoding_thread_pool_manager.finalize_all_hashing_threads() {
let mut hash_value = HashValue::new_empty(hash_type.clone());
hash_value.set_hash(hash.to_vec());
if let Some(signing_key) = &self.signing_key {
let signature = Signature::sign(signing_key, &hash);
hash_value.set_ed25519_signature(signature);
}
hash_values.push(hash_value);
if let Some(signing_key) = &self.signing_key {
let signature = Signature::sign(signing_key, &hash);
hash_value.set_ed25519_signature(signature);
}
hash_values.push(hash_value);
}

#[cfg(feature = "log")]
Expand Down
3 changes: 1 addition & 2 deletions src/lib/object/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ impl HashingThread {
drop(wg);
hasher.update(&r_data);
} else {
let hash = hasher.finalize();
hasher = Hash::new_hasher(&hash_type);
let hash = hasher.finalize_reset();
drop(wg);
hash_sender.send(hash.to_vec()).unwrap();
}
Expand Down

0 comments on commit 854fc72

Please sign in to comment.