Check.hs_hmac: def of bend-osdev-crypto@0.1.0.0 Import: import bend-osdev-crypto@0.1.0.0/check.bend as Check Lines 357-363 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=357&end_line=363 import Base import bend-osdev-bytes@0.1.0.0/bytes.bend as B import bend-osdev-crypto@0.1.0.0/hmac.bend as Hm # HMAC over a hash of the hashes package, in one call and in two pieces, # and verify of the tag def hs_hmac(~H: Data, ~bsize: Nat, ~init: H, ~update: H -> B.Octets -> H, ~final: H -> B.Octets, ~digest: B.Octets -> B.Octets, +k: B.Octets, +a: B.Octets, +b: B.Octets) -> String: +kk = Hm.CrHmac.key(~bsize, ~digest, k) +t = Hm.CrHmac.mac(~digest, kk, B.Octets.append(a, b)) +t2 = Hm.CrHmac.finish(~H, ~init, ~update, ~final, Hm.CrHmac.update(~H, ~update, Hm.CrHmac.update(~H, ~update, Hm.CrHmac.start(~H, ~init, ~update, kk), a), b)) cat(B.Octets.hex(t), cat(" ", cat(B.Octets.hex(t2), cat(" ", yes_no(Hm.CrHmac.verify(~digest, kk, B.Octets.append(a, b), t)))))) Uses (13): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat 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-bytes@0.1.1.0/bytes.bend&name=Octets.append https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/bytes.bend&name=Octets.hex 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=yes_no https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/hmac.bend&name=CrHmac.finish https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/hmac.bend&name=CrHmac.key https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/hmac.bend&name=CrHmac.mac https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/hmac.bend&name=CrHmac.start https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/hmac.bend&name=CrHmac.update https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/hmac.bend&name=CrHmac.verify