def le8
import bend-collections@1.0.0.0/spec/crypto/chacha20poly1305.bend as Chacha20poly1305import Base
23# num_to_8_le_bytes
24def le8(n: Nat, +x: Nat) -> List<&2, U32>:
25 match n:
26 case 0n: Nil{}
27 case 1n+k: U32.from_nat(Nat.mod(x, 256n)) <> le8(k, Nat.div(x, 256n))