def window_rounds

bend-collections@1.0.0.0 · src/crypto/sha/core.bend:127

import bend-collections@1.0.0.0/src/crypto/sha/core.bend as Core
import Base
import bend-collections@1.0.0.0/src/crypto/sha/state.bend as S

127# A fixed rolling window drops schedule words as soon as they are older than 16
128# rounds. This avoids growing and reference-counting the reverse history list.
129def window_rounds(n: Nat, win: ShaWindow, ks: List<&2, U32>, s: S.State) -> S.State:
130  match n win ks:
131    case 0n _ _:
132      s
133    case 1n+q _ Nil{}:
134      s
135    case 1n+q W{a, +b, c, d, e, f, +g, h, i, j, l, m, o, r, +t, +u} k <> kt:
136      +w = (small1(b) + g + small0(t) + u : U32)
137      window_rounds(q, W{w, a, b, c, d, e, f, g, h, i, j, l, m, o, r, t}, kt,
138        step(s, k, w))

Uses (9)

Used by (53)