use rust-argon2 instead (same as stronghold)

pull/449/head
Lucas Nogueira 2 years ago
parent 6e5317f943
commit 77e014b662
No known key found for this signature in database
GPG Key ID: FFEA6C72E73482F1

24
Cargo.lock generated

@ -102,17 +102,6 @@ version = "1.0.68"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61"
[[package]]
name = "argon2"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95c2fcf79ad1932ac6269a738109997a83c227c09b75842ae564dc8ede6a861c"
dependencies = [
"base64ct",
"blake2",
"password-hash",
]
[[package]] [[package]]
name = "arrayref" name = "arrayref"
version = "0.3.6" version = "0.3.6"
@ -2861,17 +2850,6 @@ dependencies = [
"windows-sys 0.42.0", "windows-sys 0.42.0",
] ]
[[package]]
name = "password-hash"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166"
dependencies = [
"base64ct",
"rand_core 0.6.4",
"subtle",
]
[[package]] [[package]]
name = "paste" name = "paste"
version = "1.0.11" version = "1.0.11"
@ -4480,7 +4458,6 @@ dependencies = [
name = "tauri-plugin-stronghold" name = "tauri-plugin-stronghold"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"argon2",
"hex", "hex",
"iota-crypto 0.21.0", "iota-crypto 0.21.0",
"iota_stronghold", "iota_stronghold",
@ -4488,6 +4465,7 @@ dependencies = [
"rand 0.8.5", "rand 0.8.5",
"rand_chacha 0.3.1", "rand_chacha 0.3.1",
"rand_core 0.6.4", "rand_core 0.6.4",
"rust-argon2",
"rusty-fork", "rusty-fork",
"serde", "serde",
"serde_json", "serde_json",

@ -21,7 +21,7 @@ hex = "0.4"
zeroize = { version = "1", features = ["zeroize_derive"] } zeroize = { version = "1", features = ["zeroize_derive"] }
# kdf dependencies # kdf dependencies
argon2 = { version = "0.5.0", optional = true } rust-argon2 = { version = "1", optional = true }
rand_chacha = { version = "0.3.1", optional = true } rand_chacha = { version = "0.3.1", optional = true }
rand_core = { version = "0.6.4", features = ["getrandom"], optional = true } rand_core = { version = "0.6.4", features = ["getrandom"], optional = true }
@ -31,4 +31,4 @@ rusty-fork = "0.3"
[features] [features]
default = ["kdf"] default = ["kdf"]
kdf = ["dep:argon2", "dep:rand_chacha", "dep:rand_core"] kdf = ["dep:rust-argon2", "dep:rand_chacha", "dep:rand_core"]

@ -1,4 +1,3 @@
use argon2::Argon2;
use rand_chacha::ChaCha20Rng; use rand_chacha::ChaCha20Rng;
use rand_core::{RngCore, SeedableRng}; use rand_core::{RngCore, SeedableRng};
use std::path::Path; use std::path::Path;
@ -17,11 +16,8 @@ impl KeyDerivation {
let mut salt = [0u8; HASH_LENGTH]; let mut salt = [0u8; HASH_LENGTH];
create_or_get_salt(&mut salt, salt_path); create_or_get_salt(&mut salt, salt_path);
let mut encoded = [0u8; HASH_LENGTH]; argon2::hash_raw(password.as_bytes(), &salt, &Default::default())
Argon2::default() .expect("Failed to generate hash for password")
.hash_password_into(password.as_bytes(), &salt, &mut encoded)
.expect("Failed to generate hash for password");
encoded.to_vec()
} }
} }

Loading…
Cancel
Save