aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Grois <andi@grois.info>2024-06-01 21:57:04 +0200
committerAndreas Grois <andi@grois.info>2024-06-01 21:57:04 +0200
commit63832a24759a9502d86bbc8700a5960f95759598 (patch)
tree7d81e978ad0c48900272c3e511b962c73ef81b0d
parent0a89a1d45f0469798cdbc0f8a434026f0c676ba3 (diff)
Make strum an optional dependency.
To enable it, enable the "strum" feature flag.
-rw-r--r--Cargo.toml7
-rw-r--r--src/lib.rs10
2 files changed, 11 insertions, 6 deletions
diff --git a/Cargo.toml b/Cargo.toml
index a50c73d..247a523 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,13 +16,16 @@ readme = "README.md"
default = ["precomputed_common_max_powers"]
precomputed_max_powers = ["precomputed_common_max_powers"]
precomputed_common_max_powers = []
+strum = ["dep:strum", "dep:strum_macros"]
[dependencies]
unicode-segmentation = "1.10.0"
-strum = "0.26.0"
-strum_macros = "0.26.0"
+strum = { version = "0.26.0", optional = true }
+strum_macros = { version = "0.26.0", optional = true }
[dev-dependencies]
+strum = "0.26.0"
+strum_macros = "0.26.0"
digest = "0.10.5"
md4 = "0.10.2"
md-5 = "0.10.5"
diff --git a/src/lib.rs b/src/lib.rs
index 5367cf5..5b8a0a2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -158,7 +158,8 @@ impl<'a, T : HasherList> PasswordMaker<'a, T>{
/// The leet level to use. The higher the value, the more obfuscated the results.
#[cfg_attr(test, derive(strum_macros::EnumIter))]
-#[derive(Debug,Clone, Copy, strum_macros::EnumString, strum_macros::VariantNames)]
+#[cfg_attr(feature = "strum", derive(strum_macros::EnumString, strum_macros::VariantNames))]
+#[derive(Debug,Clone, Copy)]
pub enum LeetLevel {
/// First Leet level:\
/// `["4", "b", "c", "d", "3", "f", "g", "h", "i", "j", "k", "1", "m", "n", "0", "p", "9", "r", "s", "7", "u", "v", "w", "x", "y", "z"]`
@@ -201,7 +202,8 @@ pub enum LeetLevel {
/// to UTF-16 and the discarding of the upper bytes, in addition it disregards the user-supplied character set completely, and instead
/// just outputs the hash encoded as hexadecimal numbers.
/// The `HmacMd5Version06` is similarly ignoring the supplied characters and using hexadecimal numbers as output.
-#[derive(Debug,Clone, Copy, strum_macros::EnumString, strum_macros::VariantNames)]
+#[cfg_attr(feature = "strum", derive(strum_macros::EnumString, strum_macros::VariantNames))]
+#[derive(Debug,Clone, Copy)]
pub enum HashAlgorithm {
/// Regular Md4 PasswordMaker Pro setting.
Md4,
@@ -236,8 +238,8 @@ pub enum HashAlgorithm {
/// It is always applied to each password part when the required password length
/// is longer than the length obtained by computing a single hash. This is important if the input data or output charset contains certain
/// characters where the lower case representation depends on context (e.g. 'Σ').
-#[derive(Debug,Clone, Copy, strum_macros::EnumDiscriminants, strum_macros::VariantNames)]
-#[strum_discriminants(derive(strum_macros::EnumString))]
+#[cfg_attr(feature = "strum", derive(strum_macros::EnumDiscriminants, strum_macros::VariantNames), strum_discriminants(derive(strum_macros::EnumString)))]
+#[derive(Debug,Clone, Copy)]
pub enum UseLeetWhenGenerating {
/// Do not apply Leet on input or output.
NotAtAll,