Use sha2 package instead of rust-crypto (#214)

* Use sha2 package instead of rust-crypto

* Bump rfd-notify version from 0.2.1 to 0.2.2
This commit is contained in:
Dave Gallant
2022-10-08 20:30:20 -07:00
committed by GitHub
parent 7524b79735
commit 6b1d5cb57d
4 changed files with 70 additions and 101 deletions

View File

@@ -3,7 +3,6 @@ extern crate pretty_env_logger;
#[macro_use]
extern crate log;
extern crate clap;
extern crate crypto;
mod config;
mod db;
mod mail;

View File

@@ -1,10 +1,9 @@
use crate::config::Config;
use crate::db;
use crate::mail;
use crypto::digest::Digest;
use crypto::sha2::Sha256;
use regex::RegexBuilder;
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
#[derive(Serialize, Deserialize)]
pub struct Deals {
@@ -69,8 +68,9 @@ pub fn parse_posts(response: String) -> Posts {
fn hash_deal(topic: &Topic) -> String {
let digest = format!("{}{}{}", topic.web_path, topic.title, topic.post_time);
let mut hasher = Sha256::new();
hasher.input_str(&digest);
hasher.result_str()
hasher.update(digest);
let result: String = format!("{:X}", hasher.finalize());
result
}
pub fn match_deals(deals: Deals, config: Config, dbpath: &str) {