#sha-256 #hmac #digest #hmac-sha256 #quickly #single #svm

solana-hmac-sha256

An efficient implementation of HMAC-SHA256 for SVM

2 unstable releases

0.2.0 Sep 14, 2024
0.1.0 Sep 12, 2024

#22 in #svm

Download history 321/week @ 2024-09-09 73/week @ 2024-09-16 26/week @ 2024-09-23 53/week @ 2024-09-30

58 downloads per month
Used in 2 crates (via solana-hmac-drbg)

MIT license

5KB
88 lines

solana-hmac-sha256

A simple implementation of HMAC Sha256 using solana-nostd-sha256

Usage

To emulate the digest functionality of the hmac crate, use HmacSha256:

let mut h = HmacSha256::new(b"test");
h.update(b"test");
h.finalize(); // -> outputs [u8;32]

This is most useful for chaining hashes together.

To quickly produce a single hmac-sha256 hash, use the hmac_sha256 function:

let h = hmac_sha256(b"test", b"test"); // -> [u8;32]

Dependencies

~450KB
~10K SLoC