hmac_sign

Function hmac_sign 

Source
pub fn hmac_sign(
    message: &str,
    secret: &str,
    algorithm: HashAlgorithm,
    digest: DigestFormat,
) -> Result<String>
Expand description

Generates an HMAC signature for a message.

§Arguments

  • message - Message to sign
  • secret - Secret key for HMAC
  • algorithm - Hash algorithm to use
  • digest - Output encoding format

§Returns

Encoded signature string.

§Errors

Returns error if algorithm is not supported for HMAC.

§Examples

use ccxt_core::auth::{hmac_sign, HashAlgorithm, DigestFormat};

let signature = hmac_sign(
    "test message",
    "secret_key",
    HashAlgorithm::Sha256,
    DigestFormat::Hex
).unwrap();