perf: changed md5 library to use asm instructions

This commit is contained in:
Observer KRypt0n_ 2023-02-26 13:59:28 +02:00
parent c8b905d263
commit e662699b99
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2
3 changed files with 6 additions and 4 deletions

View file

@ -19,14 +19,14 @@ enum-ordinalize = { version = "3.1", optional = true }
wincompatlib = { version = "0.2", optional = true } wincompatlib = { version = "0.2", optional = true }
lazy_static = { version = "1.4", optional = true } lazy_static = { version = "1.4", optional = true }
md5 = { version = "0.7", optional = true } md-5 = { version = "0.10", features = ["asm"], optional = true }
[features] [features]
states = [] states = []
config = ["dep:serde", "dep:serde_json", "dep:enum-ordinalize"] config = ["dep:serde", "dep:serde_json", "dep:enum-ordinalize"]
components = ["dep:wincompatlib", "dep:lazy_static"] components = ["dep:wincompatlib", "dep:lazy_static"]
game = ["components", "config"] game = ["components", "config"]
fps-unlocker = ["dep:md5"] fps-unlocker = ["dep:md-5"]
default = ["all"] default = ["all"]
all = ["states", "config", "components", "game", "fps-unlocker"] all = ["states", "config", "components", "game", "fps-unlocker"]

@ -1 +1 @@
Subproject commit 96cee069953819eb0ee758298c05b5eb2b8f6b7f Subproject commit ef498b2e16f9b4cc4c1ee6357e73caf4fbc81dec

View file

@ -2,6 +2,8 @@ use std::path::PathBuf;
use anime_game_core::installer::downloader::Downloader; use anime_game_core::installer::downloader::Downloader;
use md5::{Md5, Digest};
use crate::config::game::enhancements::fps_unlocker::config::Config as FpsUnlockerConfig; use crate::config::game::enhancements::fps_unlocker::config::Config as FpsUnlockerConfig;
pub mod config_schema; pub mod config_schema;
@ -26,7 +28,7 @@ impl FpsUnlocker {
pub fn from_dir<T: Into<PathBuf> + std::fmt::Debug>(dir: T) -> anyhow::Result<Option<Self>> { pub fn from_dir<T: Into<PathBuf> + std::fmt::Debug>(dir: T) -> anyhow::Result<Option<Self>> {
let dir = dir.into(); let dir = dir.into();
let hash = format!("{:x}", md5::compute(std::fs::read(dir.join("unlocker.exe"))?)); let hash = format!("{:x}", Md5::digest(std::fs::read(dir.join("unlocker.exe"))?));
Ok(if hash == LATEST_INFO.0 { Ok(if hash == LATEST_INFO.0 {
Some(Self { dir }) Some(Self { dir })