Hmac.shorten_if: def of bend-collections@1.0.0.0 Import: import bend-collections@1.0.0.0/spec/crypto/hmac.bend as Hmac Lines 27-34 of bend-collections@1.0.0.0/spec/crypto/hmac.bend: https://jend.leeeet.dev/read.txt?path=bend-collections@1.0.0.0/spec/crypto/hmac.bend&start_line=27&end_line=34 import Base # FIPS 198-1 steps 1-3: a key of exactly B bytes is K0 itself; a longer key # is hashed first (K0 = H(K) || zeros); a shorter one is zero-padded to B. def shorten_if(+key: List<&2, U32>, fits: Bool) -> List<&2, U32>: match fits: case True{}: key case False{}: hash(key) Uses (4): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool 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=bend-collections@1.0.0.0/spec/crypto/hmac.bend&name=hash