Hmac

object Hmac

Utility for computing HMAC-SHA256 signatures.

Properties

Link copied to clipboard
const val ALGORITHM: String

Algorithm used for HMAC.

Functions

Link copied to clipboard
fun sign(key: ByteArray, data: ByteArray): ByteArray

Computes HMAC-SHA256 signature for data using key.

Link copied to clipboard
fun verify(key: ByteArray, data: ByteArray, expected: ByteArray): Boolean

Verifies that expected matches the signature for data with key. Uses constant-time comparison.