Skip to content

Commit

Permalink
Merge pull request #45 from bgpkit/hotfix-digest-without-decompression
Browse files Browse the repository at this point in the history
use raw reader for digesting to avoid decompression
  • Loading branch information
digizeph authored Jan 27, 2024
2 parents 32105d0 + 8723146 commit 3132c36
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/oneio/digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
//!
//! The digest is calculated using the SHA256 algorithm.
use crate::{get_reader, OneIoError};
use crate::oneio::get_reader_raw;
use crate::OneIoError;
use ring::digest::{Context, SHA256};

/// Calculate the SHA256 digest of a file.
Expand All @@ -23,7 +24,7 @@ pub fn get_sha256_digest(path: &str) -> Result<String, OneIoError> {
let mut context = Context::new(&SHA256);
let mut buffer = [0; 1024];

let mut reader = get_reader(path)?;
let mut reader = get_reader_raw(path)?;
loop {
let count = reader.read(&mut buffer)?;
if count == 0 {
Expand Down

0 comments on commit 3132c36

Please sign in to comment.