Poly1305.fold: def of bend-collections@1.0.0.0 Import: import bend-collections@1.0.0.0/spec/crypto/poly1305.bend as Poly1305 Lines 27-30 of bend-collections@1.0.0.0/spec/crypto/poly1305.bend: https://jend.leeeet.dev/read.txt?path=bend-collections@1.0.0.0/spec/crypto/poly1305.bend&start_line=27&end_line=30 import Base import bend-collections@1.0.0.0/spec/lib/common.bend as C # x = lo + 2^130 hi is congruent to lo + 5 hi mod p (2^130 = p + 5); the fold # strictly decreases x while hi > 0, so x folds bring x below 2^130. def fold(+x: Nat) -> Nat: Nat.add(C.low(130n, x), Nat.mul(C.high(130n, x), 5n)) Uses (5): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.mul https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/spec/lib/common.bend&name=high https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/spec/lib/common.bend&name=low