Check.hmac_crc32: def of bend-osdev-crypto@0.1.0.0 Import: import bend-osdev-crypto@0.1.0.0/check.bend as Check Lines 246-252 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=246&end_line=252 import Base import bend-osdev-bytes@0.1.0.0/bytes.bend as B import bend-osdev-crc@0.1.0.0/crc.bend as C import bend-osdev-crypto@0.1.0.0/hmac.bend as Hm import bend-osdev-crypto@0.1.0.0/inst_crc.bend as CR # HMAC over CRC-32: one-shot, in two pieces, and verify def hmac_crc32(+k: B.Octets, +a: B.Octets, +b: B.Octets) -> String: +kk = Hm.CrHmac.key(~64n, ~CR.CrCrc32.digest(~C.crc32.spec()), k) +t = Hm.CrHmac.mac(~CR.CrCrc32.digest(~C.crc32.spec()), kk, B.Octets.append(a, b)) +s = Hm.CrHmac.start(~U32, ~CR.CrCrc32.init(~C.crc32.spec()), ~CR.CrCrc32.update(~C.crc32.spec()), kk) +t2 = Hm.CrHmac.finish(~U32, ~CR.CrCrc32.init(~C.crc32.spec()), ~CR.CrCrc32.update(~C.crc32.spec()), ~CR.CrCrc32.final(~C.crc32.spec()), Hm.CrHmac.update(~U32, ~CR.CrCrc32.update(~C.crc32.spec()), Hm.CrHmac.update(~U32, ~CR.CrCrc32.update(~C.crc32.spec()), s, a), b)) cat(B.Octets.hex(t), cat(" ", cat(B.Octets.hex(t2), cat(" ", yes_no(Hm.CrHmac.verify(~CR.CrCrc32.digest(~C.crc32.spec()), kk, B.Octets.append(a, b), t)))))) Uses (18): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 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-crc@0.1.0.0/crc.bend&name=crc32.spec 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 https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/inst_crc.bend&name=CrCrc32.digest https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/inst_crc.bend&name=CrCrc32.final https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/inst_crc.bend&name=CrCrc32.init https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/inst_crc.bend&name=CrCrc32.update