Skip to content

Commit

Permalink
k256: improve documentation for sha256 feature (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarcieri authored Sep 21, 2020
1 parent 836e523 commit 2ff8175
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
16 changes: 15 additions & 1 deletion k256/src/ecdsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,23 @@
//! [`VerifyKey`] types which natively implement ECDSA/secp256k1 signing and
//! verification.
//!
//! Additionally, this crate contains support for computing ECDSA signatures
//! using either the SHA-256 (standard) or Keccak-256 (Ethereum) digest
//! functions, which are gated under the following Cargo features:
//!
//! - `sha256`: compute signatures using NIST's standard SHA-256 digest
//! function. Unless you are computing signatures for Ethereum, this is
//! almost certainly what you want.
//! - `keccak256`: compute signatures using the Keccak-256 digest function,
//! an incompatible variant of the SHA-3 algorithm used exclusively by
//! Ethereum.
//!
//! Most users of this library who want to sign/verify signatures will want to
//! enable the `ecdsa` and `sha256` Cargo features.
//!
//! ## Signing/Verification Example
//!
//! This example requires the `ecdsa` Cargo feature is enabled:
//! This example requires the `ecdsa` and `sha256` Cargo features are enabled:
//!
//! ```
//! # #[cfg(feature = "ecdsa")]
Expand Down
4 changes: 2 additions & 2 deletions k256/src/ecdsa/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl From<&SecretKey> for SigningKey {
}
}

#[cfg(feature = "sha256")]
#[cfg(any(feature = "keccak256", feature = "sha256"))]
impl<S> signature::Signer<S> for SigningKey
where
S: PrehashSignature,
Expand All @@ -77,7 +77,7 @@ where
}
}

#[cfg(feature = "sha256")]
#[cfg(any(feature = "keccak256", feature = "sha256"))]
impl<S> RandomizedSigner<S> for SigningKey
where
S: PrehashSignature,
Expand Down

0 comments on commit 2ff8175

Please sign in to comment.