Hashes.HsMd.md_pad: def of bend-osdev-hashes@0.1.0.0 Import: import bend-osdev-hashes@0.1.0.0/hashes.bend as Hashes Lines 180-185 of bend-osdev-hashes@0.1.0.0/hashes.bend: https://jend.leeeet.dev/read.txt?path=bend-osdev-hashes@0.1.0.0/hashes.bend&start_line=180&end_line=185 import Base import bend-osdev-bytes@0.1.0.0/bytes.bend as B # The Merkle-Damgard padding after cnt bytes of an unfinished block: the # byte 0x80, zeros, then the length field, so that the whole is a number of # blocks (the block size last + 1 a power of two) def HsMd.md_pad(~last: U32, +cnt: U32, +field: List<&2, U32>) -> List<&2, U32>: +k = U32.and(U32.sub(U32.sub(last, U32.from_nat(B.len(field))), cnt), last) Con{128, B.append(B.zeros(U32.to_nat(k)), field)} Uses (9): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.from_nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.sub https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_nat https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/bytes.bend&name=append https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/bytes.bend&name=len https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/bytes.bend&name=zeros