Check.cmac: def of bend-osdev-crypto@0.1.0.0 Import: import bend-osdev-crypto@0.1.0.0/check.bend as Check Lines 229-231 of bend-osdev-crypto@0.1.0.0/check.bend: https://jend.leeeet.dev/read.txt?path=bend-osdev-crypto@0.1.0.0/check.bend&start_line=229&end_line=231 import Base import bend-osdev-bytes@0.1.0.0/bytes.bend as B import bend-osdev-cipher-modes@0.1.0.0/aes.bend as X import bend-osdev-crypto@0.1.0.0/crypto.bend as Cr import bend-osdev-crypto@0.1.0.0/mac.bend as Mc import bend-osdev-crypto@0.1.0.0/inst_aes.bend as A import bend-osdev-crypto@0.1.0.0/inst_cmac.bend as CMI def cmac(+k: B.Octets, +m: B.Octets) -> String: +t = Mc.CrMac.compute_with(~X.CmAesKey, ~A.CrAes.key_enc, ~CMI.CrCmac.mac(~X.CmAesKey, ~X.CmAes.encrypt), k, m) cat(show(t), cr.check.verify(Result.map(&2, &2, Cr.CrError, B.Octets, Bool, +tag => Result.default(&2, &2, Cr.CrError, Bool, Result.map(&2, &2, Cr.CrError, X.CmAesKey, Bool, +kk => Bool.and(CMI.CrCmac.verify(~X.CmAesKey, ~X.CmAes.encrypt, kk, m, tag), Bool.not(CMI.CrCmac.verify(~X.CmAesKey, ~X.CmAes.encrypt, kk, m, flip_last(tag)))), A.CrAes.key_enc(k)), False{}), t))) Uses (18): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.not https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result.default https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result.map https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/bytes.bend&name=Octets https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/aes.bend&name=CmAes.encrypt https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/aes.bend&name=CmAesKey https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/check.bend&name=cat https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/check.bend&name=cr.check.verify https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/check.bend&name=flip_last https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/check.bend&name=show https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/crypto.bend&name=CrError https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/inst_aes.bend&name=CrAes.key_enc https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/inst_cmac.bend&name=CrCmac.mac https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/inst_cmac.bend&name=CrCmac.verify https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/mac.bend&name=CrMac.compute_with