def cr.vm.mac

bend-osdev-crypto@0.1.0.0 · vmac.bend:457

import bend-osdev-crypto@0.1.0.0/vmac.bend as Vmac
import Base
import bend-osdev-bytes@0.1.0.0/bytes.bend as B

457# As a MAC: the nonce is the message's first nlen bytes (1 to bsize - 1),
458# the data the rest; a message too short for its nonce has the empty tag
459def cr.vm.mac(~K: Data, ~Blk: Data, ~bsize: Nat, ~enc: K -> Blk -> Blk, ~blk_of: B.Octets -> Maybe<&2, Blk>, ~blk_to: Blk -> B.Octets, ~nlen: Nat, kk: CrVmacKey<K>, +m: B.Octets) -> B.Octets:
460  cr.vm.or_empty(CrVmac.tag(~K, ~Blk, ~bsize, ~enc, ~blk_of, ~blk_to, kk, B.Octets.take(nlen, m), B.Octets.drop(nlen, m)))

Uses (8)

Used by (1)