Skip to content

Commit

Permalink
argon2: only enable password-hash dependency if its been explicitly r…
Browse files Browse the repository at this point in the history
…equested (#521)
  • Loading branch information
BlackHoleFox authored Aug 26, 2024
1 parent 3898a33 commit eefdb54
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
6 changes: 3 additions & 3 deletions argon2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ password-hash = { version = "0.6.0-rc.0", features = ["rand_core"] }

[features]
default = ["alloc", "password-hash", "rand"]
alloc = ["password-hash/alloc"]
std = ["alloc", "password-hash/std"]
alloc = ["password-hash?/alloc"]
std = ["alloc", "password-hash?/std"]

rand = ["password-hash/rand_core"]
rand = ["password-hash?/rand_core"]
simple = ["password-hash"]

[lints.rust.unexpected_cfgs]
Expand Down
14 changes: 10 additions & 4 deletions argon2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@
//! password-based authentication. Do not use this API to derive cryptographic
//! keys: see the "key derivation" usage example below.
//!
#![cfg_attr(feature = "std", doc = "```")]
#![cfg_attr(not(feature = "std"), doc = "```ignore")]
#![cfg_attr(all(feature = "password-hash", feature = "std"), doc = "```")]
#![cfg_attr(
not(all(feature = "password-hash", feature = "std")),
doc = "```ignore"
)]
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! use argon2::{
//! password_hash::{
Expand Down Expand Up @@ -65,8 +68,11 @@
//! This API is useful for transforming a password into cryptographic keys for
//! e.g. password-based encryption.
//!
#![cfg_attr(feature = "std", doc = "```")]
#![cfg_attr(not(feature = "std"), doc = "```ignore")]
#![cfg_attr(all(feature = "password-hash", feature = "std"), doc = "```")]
#![cfg_attr(
not(all(feature = "password-hash", feature = "std")),
doc = "```ignore"
)]
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! use argon2::Argon2;
//!
Expand Down

0 comments on commit eefdb54

Please sign in to comment.