def le_bytes

bend-collections-laws-crypto@1.0.0.0 · spec/crypto/curve25519/x25519.bend:55

import bend-collections-laws-crypto@1.0.0.0/spec/crypto/curve25519/x25519.bend as X25519
import Base

55# encodeUCoordinate: u mod p as 32 little-endian bytes
56def le_bytes(n: Nat, +x: Nat) -> List<&2, U32>:
57  match n:
58    case 0n:
59      Nil{}
60    case 1n+m:
61      Con{U32.from_nat(Nat.mod(x, 256n)), le_bytes(m, Nat.div(x, 256n))}

Uses (6)

Used by (13)