From 53c4c680d13f995f432013fd09636b86cf36aaaa Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Mon, 15 Sep 2025 02:40:25 +0200 Subject: [PATCH] Zip --- Cargo.toml | 7 +++++++ src/main.rs | 20 +++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bb71dd7..e5759be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,3 +6,10 @@ edition = "2024" [dependencies] clap = { version = "4.5.47", features = ["derive"] } regex = "1.11.2" + +[profile.release] +opt-level = "z" +strip = true +lto = true +codegen-units = 1 +panic = "abort" diff --git a/src/main.rs b/src/main.rs index 6148a70..e716867 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,9 +2,10 @@ // Struct record plus hash ? // Letter frequency as weight // find better weight -#![allow(dead_code)] +// #![allow(dead_code)] use clap::Parser; use regex::Regex; +use std::fmt::Display; #[derive(Parser, Debug)] #[command(version, about, long_about = None)] @@ -30,8 +31,6 @@ struct Args { out: Option, } -use std::{fmt::Display, fs::read_to_string}; - #[derive(Debug, Eq, PartialEq, Clone)] struct Word { origin: String, @@ -89,6 +88,7 @@ impl Weightlist { self.weights[c as usize - 'a' as usize] = val; } + #[allow(dead_code)] fn getid(&self, id: usize) -> isize { self.weights[id] } @@ -107,13 +107,19 @@ impl Weightlist { } } -fn read_list(path: &str) -> Vec { - read_to_string(path) - .unwrap() +fn load_words() -> Vec { + String::from_utf8_lossy(include_bytes!("../wordlists/final.txt")) .split("\n") .map(|s| s.into()) .collect() } +// fn read_list(path: &str) -> Vec { +// read_to_string(path) +// .unwrap() +// .split("\n") +// .map(|s| s.into()) +// .collect() +// } #[derive(Debug, Clone)] struct Wordlist { @@ -244,7 +250,7 @@ fn backtrack_best( } } fn main() { - let wl = Wordlist::new(read_list("./wordlists/final.txt")); + let wl = Wordlist::new(load_words()); let weights = wl.make_weights(); let args = Args::parse();