def hmac

bend-collections-laws-crypto@1.0.0.0 · spec/crypto/hmac.bend:54

import bend-collections-laws-crypto@1.0.0.0/spec/crypto/hmac.bend as Hmac
import Base

54# HMAC(K, text) = H((K0 ^ opad) || H((K0 ^ ipad) || text))   (steps 4-9).
55def hmac(+key: List<&2, U32>, text: List<&2, U32>) -> List<&2, U32>:
56  +k = k0(key)
57  hash(List.append(&2, U32, xor_pad(k, opad()),
58    hash(List.append(&2, U32, xor_pad(k, ipad()), text))))

Uses (8)

Used by (11)