def mask_top
import bend-collections-laws-crypto@1.0.0.0/src/crypto/curve25519/field.bend as Fieldimport Base
275# the last byte with its top bit cleared (RFC 7748 decodeUCoordinate)
276def mask_top(xs: List<&2, U32>) -> List<&2, U32>:
277 match xs:
278 case Nil{}:
279 Nil{}
280 case Con{x, xt}:
281 match xt:
282 case Nil{}:
283 Con{U32.and(x, 127), Nil{}}
284 case Con{y, yt}:
285 Con{x, mask_top(Con{y, yt})}
Uses (3)
Used by (5)
- bend-collections-laws-crypto@1.0.0.0/src/crypto/curve25519/field:of_bytes
- bend-collections-laws-crypto@1.0.0.0/proofs/crypto/curve25519/xbits:mask_okb
- bend-collections-laws-crypto@1.0.0.0/proofs/crypto/curve25519/xbits:mask_eq
- bend-collections-laws-crypto@1.0.0.0/proofs/crypto/ed25519/pdec:decode_rel
- bend-collections-laws-crypto@1.0.0.0/proofs/crypto/curve25519/ladder:x25519_rel