def bulk.go
import bend-osdev-cipher-modes@0.1.0.0/check.bend as Checkimport Base
47# Longer messages, as a regression test for long inputs: 32 KB of
48# pseudo-random bytes (a linear congruential generator) through CBC, and 32 KB
49# and 5 bytes through XTS (ciphertext stealing), each encrypted and decrypted
50# back; the last 16 bytes of each ciphertext were checked against Python's
51# cryptography
52def bulk.go(n: Nat, +s: U32, acc: List<&2, U32>) -> List<&2, U32>:
53 match n:
54 case 0n:
55 acc
56 case 1n+p:
57 +s2 = U32.add(U32.mul(s, 1103515245), 12345)
58 bulk.go(p, s2, Con{U32.and(U32.shrn(s2, 16n), 255), acc})