def value

bend-collections-laws-crypto@1.0.0.0 · spec/crypto/curve25519/field.bend:33

import bend-collections-laws-crypto@1.0.0.0/spec/crypto/curve25519/field.bend as Field
import Base
import bend-collections-laws-crypto@1.0.0.0/spec/lib/common.bend as C

33# decodeLittleEndian (RFC 7748 section 5): sum of b_i 2^(8 i)
34def value(xs: List<&2, U32>) -> Nat:
35  match xs:
36    case Nil{}:
37      0n
38    case Con{h, t}:
39      Nat.add(U32.to_nat(h), C.shift(8n, value(t)))

Uses (6)

Used by (162)