Capy-Bearer Documentation

hmac_md5

lib call

Capy

function hmac_md5(key : string, value : string) string

Description

hmac_md5() returns 16 raw HMAC-MD5 bytes. Use hex(hmac_md5(key, value)) when you need lowercase hexadecimal text, the form of PHP hash_hmac("md5", value, key).

Use it to check signatures from services that still sign with HMAC-MD5, such as Patreon webhooks. Compare a received signature with crypto_equal(). Use hmac_sha256() for new signatures.

Parameters

key : the secret key bytes

value : the message bytes

Return Values

A raw 16-byte HMAC-MD5 value.

Example

Capy

print(hex(hmac_md5("key", "The quick brown fox jumps over the lazy dog")), "\n")

Output

80070713463e7749b90c2dc24911e275