def zero_count_if

bend-collections-laws-crypto@1.0.0.0 · spec/crypto/sha.bend:49

import bend-collections-laws-crypto@1.0.0.0/spec/crypto/sha.bend as Sha
import Base

49# FIPS padding: a remainder of 0..55 leaves room in this block;
50# a remainder of 56..63 needs another block. No modular shortcut is used.
51def zero_count_if(r: Nat, fits: Bool) -> Nat:
52  match fits:
53    case True{}:
54      Nat.sub(55n, r)
55    case False{}:
56      Nat.sub(119n, r)

Uses (3)

Used by (1)