Skip to content

A pure rust library implementing hmac-sha1 Hash-based Message Authentication Code

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

lrazovic/rust-hmac-sha

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Rust-HMAC-SHA

CI status creates.io version

A pure Rust implementation of the Hash-based Message Authentication Code Algoritm for SHA-{1,2,3}. This project can be seen as an interface/wrapper for the RustCrypto crate, focusing on user/developer ease of use. Works in a #![no_std] environment.

Origins and motivations

This repo is a fork of Rust-HMAC-SHA1 by @pantsman0/Philip Woolford. Unlike the original version, it supports SHA-2 and SHA-3 in addition to SHA-1. In addition this fork uses the implementations of SHA provided by RustCrypto. Has been developed to assist in the development of OOTP.

Usage

To import rust-hmac-sha add the following to your Cargo.toml:

[dependencies]
hmac-sha = "0.6"

and any other Hash crate that statisfy the Digest trait, like sha3

[dependencies]
...
sha3 = { version = "0.9", default-features = false }

You can use rust-hmac-sha in this way:

use hex;
use hmacsha::HmacSha;
use sha3::Sha3_256;

fn main() {
    let secret_key = "A very strong secret";
    let message = "My secret message";
    let mut hasher = HmacSha::from(secret_key, message, Sha3_256::default());
    let result = hasher.compute_digest();
    println!("{}", hex::encode(result));
}

Contributions

Any contributions are welcome. This was implemented as a learning experience and any advice is appreciated.

License

This crate is licensed under the MIT or Apache licenses, as is its dependancies of the RustCrypto family. The original crate was licensed under the BSD 3-Clause license, as the old dependency sha1

About

A pure rust library implementing hmac-sha1 Hash-based Message Authentication Code

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%