def tf.rs.row
import bend-osdev-legacy-ciphers@0.1.0.0/twofish.bend as Twofishimport Base
import bend-osdev-legacy-ciphers@0.1.0.0/legacy_ciphers.bend as L
255# row r of RS times the 8 key bytes from byte j
256def tf.rs.row(n: Nat, +xs: List<&2, U32>, +r: Nat, +j: Nat, +c: Nat, acc: U32) -> U32:
257 match n:
258 case 0n:
259 acc
260 case 1n+p:
261 tf.rs.row(p, xs, r, j, Nat.add(c, 1n), U32.xor(acc, tf.gmul(L.lc.at(tf.rs(), Nat.add(Nat.mul(8n, r), c)), L.lc.at(xs, Nat.add(j, c)), 77)))