def fits_len

bend-collections-laws-crypto@1.0.0.0 · proofs/crypto/mac/hmac.bend:28

import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/mac/hmac.bend as Hmac
import Base
import bend-collections-laws-crypto@1.0.0.0/src/crypto/mac.bend as MAC

28# fits(key, n) looks at most n+1 bytes, and says length(key) <= n.
29def fits_len(+key: List<&2, U32>, +n: Nat) -> {MAC.fits(key, n) == Nat.is_le(List.length(&2, U32, key), n) : Bool}:
30  match key n:
31    case Nil{} 0n:
32      {==}
33    case Nil{} 1n+p:
34      {==}
35    case k <> rest 0n:
36      {==}
37    case k <> rest 1n+ +p:
38      fits_len(rest, p)

Uses (7)

Used by (1)