pub trait RustCryptoHmacExt {
// Required methods
fn hmac_sha256(&self) -> Hmac<Sha256>;
fn hmac_sha384(&self) -> Hmac<Sha384>;
fn hmac_sha512(&self) -> Hmac<Sha512>;
}Expand description
Extension trait to convert uselesskey HMAC fixtures into hmac::Hmac types.
§Examples
use uselesskey_core::Factory;
use uselesskey_hmac::{HmacFactoryExt, HmacSpec};
use uselesskey_rustcrypto::RustCryptoHmacExt;
use hmac::Mac;
let fx = Factory::random();
let secret = fx.hmac("my-service", HmacSpec::hs256());
let mut mac = secret.hmac_sha256();
mac.update(b"hello");
let result = mac.finalize();
assert_eq!(result.into_bytes().len(), 32);Required Methods§
Sourcefn hmac_sha256(&self) -> Hmac<Sha256>
fn hmac_sha256(&self) -> Hmac<Sha256>
Create an Hmac<Sha256> from the HMAC secret.
Sourcefn hmac_sha384(&self) -> Hmac<Sha384>
fn hmac_sha384(&self) -> Hmac<Sha384>
Create an Hmac<Sha384> from the HMAC secret.
Sourcefn hmac_sha512(&self) -> Hmac<Sha512>
fn hmac_sha512(&self) -> Hmac<Sha512>
Create an Hmac<Sha512> from the HMAC secret.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl RustCryptoHmacExt for HmacSecret
Available on crate feature hmac only.
impl RustCryptoHmacExt for HmacSecret
Available on crate feature
hmac only.