Skip to content

Commit

Permalink
refactor: rename calculate_entropy_from_file to calculate_entropy
Browse files Browse the repository at this point in the history
  • Loading branch information
Kremilly committed Dec 24, 2024
1 parent 39ceb63 commit ba0834b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/core/encrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl<'a> Encrypt<'a> {
}
}

pub fn calculate_entropy_from_file(&self) -> Result<f64> {
pub fn calculate_entropy(&self) -> Result<f64> {
let mut file = File::open(self.file_path)?;
let mut buffer = Vec::new();
file.read_to_end(&mut buffer)?;
Expand Down
4 changes: 1 addition & 3 deletions src/core/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,7 @@ impl Import {
}

pub fn dump(&self) -> Result<(), Box<dyn Error>> {
let entropy = Encrypt::new(&self.dump_file_path).calculate_entropy_from_file()?;

if entropy > 7.5 {
if Encrypt::new(&self.dump_file_path).calculate_entropy()? > 7.5 {
let _ = self.dump_encrypted();
} else {
let _ = self.dump_plain();
Expand Down

0 comments on commit ba0834b

Please sign in to comment.