ristretto255
Compute in the ristretto255 prime-order group from RFC 9496.
Warning
Hazmat: these are raw group operations. They provide no signature, key-exchange or encryption guarantees on their own, and a protocol built on them needs its own analysis.
from oxcrypto.hazmat.group.ristretto255 import RISTRETTO255
group = RISTRETTO255.RISTRETTO255
scalar = group.reduce_scalar(bytes(range(64)))
point = group.multiply_base(scalar)
assert group.subtract(group.add(point, point), point) == pointElements are 32-byte RFC 9496 encodings and scalars are 32-byte little-endian
integers below the group order. add, subtract, negate, multiply and
multiply_base return encoded elements. from_uniform_bytes maps 64 uniform
bytes to an element (section 4.3.4), and reduce_scalar reduces a 64-byte
integer modulo the group order. Non-canonical element encodings and scalars
that are not reduced raise ValueError.
Upstream
| Crate | Standard | Audit |
|---|---|---|
curve25519-dalek 5.0.0 | RFC 9496 | No published audit of this version; Quarkslab's 2019 assessment covered an earlier release |
curve25519-dalek is written to run secret-dependent arithmetic in constant
time; oxcrypto has not verified this independently. It builds with Rust 1.88,
the oxcrypto MSRV. Tests use RFC 9496 appendices A.1 to A.3.
Zeroization
Note
The decoded scalar is wiped after each call. Not covered: scalars passed in
or returned as Python bytes, and the copies curve25519-dalek makes on the
stack or in registers during scalar multiplication.