embassy-crypto

Crates

git

Versions

default

Flavors

Skip to main content

Crate embassy_crypto

Crate embassy_crypto 

Source
Expand description

RustCrypto digest and Mac trait implementations backed by embassy-crypto-driver unitraits.

This crate wraps the hardware-agnostic hash and HMAC unitraits from embassy-crypto-driver with the standard RustCrypto digest traits, so existing RustCrypto code can use embassy-registered crypto drivers without modification.

§Digest Usage

use embassy_crypto::Sha256;
use digest::Digest;

let mut hasher = Sha256::new();
hasher.update(b"hello world");
let result = hasher.finalize();

§HMAC Usage

use embassy_crypto::HmacSha256;
use digest::Mac;

let mut mac = HmacSha256::new_from_slice(b"my key").unwrap();
mac.update(b"hello world");
let result = mac.finalize();

§Linkage

At link time exactly one crate in the dependency tree must register a driver using the embassy_crypto_*_impl! and embassy_crypto_hmac_*_impl! macros from embassy-crypto-driver. If zero or multiple drivers are registered, linking will fail.

Re-exports§

pub use digest;

Structs§

HmacSha1
RustCrypto Mac implementation backed by the embassy-crypto-driver HMAC unitrait.
HmacSha224
RustCrypto Mac implementation backed by the embassy-crypto-driver HMAC unitrait.
HmacSha256
RustCrypto Mac implementation backed by the embassy-crypto-driver HMAC unitrait.
HmacSha384
RustCrypto Mac implementation backed by the embassy-crypto-driver HMAC unitrait.
HmacSha512
RustCrypto Mac implementation backed by the embassy-crypto-driver HMAC unitrait.
HmacSha512_224
RustCrypto Mac implementation backed by the embassy-crypto-driver HMAC unitrait.
HmacSha512_256
RustCrypto Mac implementation backed by the embassy-crypto-driver HMAC unitrait.
Md5
RustCrypto Digest implementation backed by the embassy-crypto-driver unitrait.
Sha1
RustCrypto Digest implementation backed by the embassy-crypto-driver unitrait.
Sha224
RustCrypto Digest implementation backed by the embassy-crypto-driver unitrait.
Sha256
RustCrypto Digest implementation backed by the embassy-crypto-driver unitrait.
Sha384
RustCrypto Digest implementation backed by the embassy-crypto-driver unitrait.
Sha512
RustCrypto Digest implementation backed by the embassy-crypto-driver unitrait.
Sha512_224
RustCrypto Digest implementation backed by the embassy-crypto-driver unitrait.
Sha512_256
RustCrypto Digest implementation backed by the embassy-crypto-driver unitrait.