aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Grois <soulsource@users.noreply.github.com>2024-05-22 18:09:38 +0200
committerGitHub <noreply@github.com>2024-05-22 18:09:38 +0200
commit0a89a1d45f0469798cdbc0f8a434026f0c676ba3 (patch)
tree8a0422c5ef868146889ad58bbb45db8bbe559cfb
parent283313e8619d629757a62487d8656fb3781dd554 (diff)
parent739f6a1f27dd91ca6ffe965a3ace173ca4d0ec45 (diff)
Merge pull request #2 from tsadowski/main
This adds some strum derive macro invocations above the enums in the public interface, for converting to/from string representation of the parameters. Long term plan is to put the strum dependency behind a feature-gate.
-rw-r--r--Cargo.toml4
-rw-r--r--src/lib.rs7
2 files changed, 6 insertions, 5 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 0ad95d9..a50c73d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,10 +19,10 @@ precomputed_common_max_powers = []
[dependencies]
unicode-segmentation = "1.10.0"
+strum = "0.26.0"
+strum_macros = "0.26.0"
[dev-dependencies]
-strum = "0.24"
-strum_macros = "0.24"
digest = "0.10.5"
md4 = "0.10.2"
md-5 = "0.10.5"
diff --git a/src/lib.rs b/src/lib.rs
index 955daf8..5367cf5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -158,7 +158,7 @@ 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)]
+#[derive(Debug,Clone, Copy, strum_macros::EnumString, strum_macros::VariantNames)]
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 +201,7 @@ 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)]
+#[derive(Debug,Clone, Copy, strum_macros::EnumString, strum_macros::VariantNames)]
pub enum HashAlgorithm {
/// Regular Md4 PasswordMaker Pro setting.
Md4,
@@ -236,7 +236,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)]
+#[derive(Debug,Clone, Copy, strum_macros::EnumDiscriminants, strum_macros::VariantNames)]
+#[strum_discriminants(derive(strum_macros::EnumString))]
pub enum UseLeetWhenGenerating {
/// Do not apply Leet on input or output.
NotAtAll,