def bits

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

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

134# RFC 7748's `bits` (255 for X25519) as 8 * len(k) - 1 of the 32-byte scalar
135def bits(k: List<&2, U32>) -> Nat:
136  Nat.sub(Nat.mul(8n, C.length(U32, k)), 1n)

Uses (6)

Used by (3)