#cryptography #crypto #hmac #optimization #sha512

no-std rigel

Minimal HMAC-SHA512 implementation optimized for embedded devices

14 releases

0.2.2 Dec 24, 2018
0.2.1 Dec 14, 2018
0.2.0 Nov 25, 2018
0.1.1 Oct 7, 2018
0.0.6 Aug 24, 2018

#98 in Cryptography

Download history 7/week @ 2018-10-21 5/week @ 2018-10-28 57/week @ 2018-11-04 47/week @ 2018-11-11 22/week @ 2018-11-18 19/week @ 2018-11-25 92/week @ 2018-12-02 63/week @ 2018-12-09 31/week @ 2018-12-16 34/week @ 2018-12-23 79/week @ 2018-12-30 5/week @ 2019-01-06 35/week @ 2019-01-13

222 downloads per month

MIT license

12KB
214 lines

rigel

Build Status codecov

About

rigel is a minimal implementation of HMAC with SHA512, which is optimized for use with embedded devices. rigel minimizes the amount of allocations made, while still upholding performance speed.

You can read more about these optimizations here.

Rust nightly

rigel requires Rust nightly.

Security

This library has at no point received any formal cryptographic/security audit. It should be used at own risk.

Example

One-shot API:

extern crate rigel;

let mac = rigel::hmac_sha512("Secret key".as_bytes(), "Message".as_bytes());

assert!(rigel::verify(&mac, "Secret key".as_bytes(), "Message".as_bytes()));

Streaming API:

extern crate rigel;

let mut mac = rigel::init("Secret key".as_bytes());
mac.update("Message".as_bytes());
let res = mac.finalize();
assert!(mac.verify(&res, "Secret key".as_bytes(), "Message".as_bytes()));

let mut mac_out = [0u8; 64];
mac.reset();
mac.update("Other message".as_bytes());
mac.finalize_with_dst(&mut mac_out);

Performance

test RustCrypto     ... bench:       2,185 ns/iter (+/- 241)
test orion          ... bench:       2,350 ns/iter (+/- 60)
test rigel_one_shot ... bench:       2,070 ns/iter (+/- 43)
test rigel_stream   ... bench:       2,122 ns/iter (+/- 35)
test ring           ... bench:       3,357 ns/iter (+/- 91)

This was benchmarked on a MacBook Air 1,6 GHz Intel Core i5, 4GB.

License

rigel is licensed under the MIT license. See the LICENSE file for more information.

Dependencies

~535KB
~11K SLoC