fix: update md5 usage and remove unused imports
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
use sha2::{Digest, Sha256, Sha512};
|
use sha2::{Digest, Sha256, Sha512};
|
||||||
use md5::Md5;
|
use md5;
|
||||||
use crate::meta_plugin::{MetaPlugin, process_metadata_outputs};
|
use crate::meta_plugin::MetaPlugin;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
enum Hasher {
|
enum Hasher {
|
||||||
Md5(Md5),
|
Md5(md5::Context),
|
||||||
Sha256(Sha256),
|
Sha256(Sha256),
|
||||||
Sha512(Sha512),
|
Sha512(Sha512),
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@ impl Hasher {
|
|||||||
fn finalize(&mut self) -> String {
|
fn finalize(&mut self) -> String {
|
||||||
match self {
|
match self {
|
||||||
Hasher::Md5(hasher) => {
|
Hasher::Md5(hasher) => {
|
||||||
let result = std::mem::replace(hasher, Md5::new()).finalize();
|
let result = hasher.clone().compute();
|
||||||
format!("{:x}", result)
|
format!("{:x}", result)
|
||||||
}
|
}
|
||||||
Hasher::Sha256(hasher) => {
|
Hasher::Sha256(hasher) => {
|
||||||
@@ -100,7 +100,7 @@ impl DigestMetaPlugin {
|
|||||||
if let Some(method_value) = plugin.options.get("method") {
|
if let Some(method_value) = plugin.options.get("method") {
|
||||||
if let Some(method_str) = method_value.as_str() {
|
if let Some(method_str) = method_value.as_str() {
|
||||||
plugin.hasher = match method_str {
|
plugin.hasher = match method_str {
|
||||||
"md5" => Some(Hasher::Md5(Md5::new())),
|
"md5" => Some(Hasher::Md5(md5::Context::new())),
|
||||||
"sha256" => Some(Hasher::Sha256(Sha256::new())),
|
"sha256" => Some(Hasher::Sha256(Sha256::new())),
|
||||||
"sha512" => Some(Hasher::Sha512(Sha512::new())),
|
"sha512" => Some(Hasher::Sha512(Sha512::new())),
|
||||||
_ => None,
|
_ => None,
|
||||||
|
|||||||
@@ -346,7 +346,7 @@ impl ItemService {
|
|||||||
MetaPluginType::Binary,
|
MetaPluginType::Binary,
|
||||||
MetaPluginType::LineCount,
|
MetaPluginType::LineCount,
|
||||||
MetaPluginType::WordCount,
|
MetaPluginType::WordCount,
|
||||||
MetaPluginType::DigestSha256,
|
MetaPluginType::Digest,
|
||||||
MetaPluginType::User,
|
MetaPluginType::User,
|
||||||
MetaPluginType::Hostname,
|
MetaPluginType::Hostname,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use crate::config::Settings;
|
use crate::config::Settings;
|
||||||
use crate::meta_plugin::{get_meta_plugin, MetaPlugin, MetaPluginType};
|
use crate::meta_plugin::{get_meta_plugin, MetaPlugin, MetaPluginType};
|
||||||
use crate::modes::common::{settings_digest_type, settings_meta_plugin_types};
|
use crate::modes::common::settings_meta_plugin_types;
|
||||||
use clap::Command;
|
use clap::Command;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use rusqlite::Connection;
|
use rusqlite::Connection;
|
||||||
|
|||||||
Reference in New Issue
Block a user