Function sha_to_hex::encode

source ·
pub fn encode(msg: &str, secret: &str) -> String
Expand description

Encode a message using secret with HMAC-SHA256 encryption

returns a hex string

§Usage

encode(msg: &str, secret: &str) -> String

§Example

use sha_to_hex::encode;

let msg = "The quick brown fox jumps over the lazy dog";
let secret = "543jklefdsjio342jiofdsoij5234orfjdso";

assert_eq!(encode(msg, secret),
           "277288e6f134b423756870fbf222f56c8e17d59d9a2df0f8c535a5ab3f84a9bb")