|
libdecaf
|
A scalar modulo the curve order. More...
#include <point_255.hxx>
Public Types | |
| typedef decaf_255_scalar_t | Wrapped |
| wrapped C type | |
Public Member Functions | |
| Scalar (uint64_t w) DECAF_NOEXCEPT | |
| Set to an unsigned word. | |
| Scalar (int64_t w) DECAF_NOEXCEPT | |
| Set to a signed word. | |
| Scalar (unsigned int w) DECAF_NOEXCEPT | |
| Set to an unsigned word. | |
| Scalar (int w) DECAF_NOEXCEPT | |
| Set to a signed word. | |
| Scalar (Rng &rng) DECAF_NOEXCEPT | |
| Construct from RNG. | |
| Scalar (const Wrapped &t=decaf_255_scalar_zero) DECAF_NOEXCEPT | |
| Construct from decaf_scalar_t object. | |
| Scalar (const Scalar &x) DECAF_NOEXCEPT | |
| Copy constructor. | |
| Scalar (const Block &buffer) DECAF_NOEXCEPT | |
| Construct from arbitrary-length little-endian byte sequence. | |
| size_t | ser_size () const DECAF_NOEXCEPT |
| Serializable instance. | |
| void | serialize_into (unsigned char *buffer) const DECAF_NOEXCEPT |
| Serializable instance. | |
| Scalar & | operator= (const Scalar &x) DECAF_NOEXCEPT |
| Assignment. | |
| Scalar & | operator= (uint64_t w) DECAF_NOEXCEPT |
| Assign from unsigned 64-bit integer. | |
| Scalar & | operator= (int64_t w) DECAF_NOEXCEPT |
| Assign from signed int. | |
| Scalar & | operator= (unsigned int w) DECAF_NOEXCEPT |
| Assign from unsigned int. | |
| Scalar & | operator= (int w) DECAF_NOEXCEPT |
| Assign from signed int. | |
| ~Scalar () DECAF_NOEXCEPT | |
| Destructor securely zeorizes the scalar. | |
| Scalar & | operator= (const Block &bl) DECAF_NOEXCEPT |
| Assign from arbitrary-length little-endian byte sequence in a Block. | |
| Scalar | operator+ (const Scalar &q) const DECAF_NOEXCEPT |
| Add. | |
| Scalar & | operator+= (const Scalar &q) DECAF_NOEXCEPT |
| Add to this. | |
| Scalar | operator- (const Scalar &q) const DECAF_NOEXCEPT |
| Subtract. | |
| Scalar & | operator-= (const Scalar &q) DECAF_NOEXCEPT |
| Subtract from this. | |
| Scalar | operator* (const Scalar &q) const DECAF_NOEXCEPT |
| Multiply. | |
| Scalar & | operator*= (const Scalar &q) DECAF_NOEXCEPT |
| Multiply into this. | |
| Scalar | operator- () const DECAF_NOEXCEPT |
| Negate. | |
| Scalar | inverse () const |
| Return 1/this. | |
| decaf_error_t DECAF_WARN_UNUSED | inverse_noexcept (Scalar &r) const DECAF_NOEXCEPT |
| Invert with Fermat's Little Theorem (slow!). | |
| Scalar | operator/ (const Scalar &q) const |
| Return this/q. | |
| Scalar & | operator/= (const Scalar &q) |
| Set this to this/q. | |
| Scalar | half () const |
| Return half this scalar. | |
| bool | operator!= (const Scalar &q) const DECAF_NOEXCEPT |
| Compare in constant time. | |
| bool | operator== (const Scalar &q) const DECAF_NOEXCEPT |
| Compare in constant time. | |
| Point | operator* (const Point &q) const DECAF_NOEXCEPT |
| Scalarmul with scalar on left. | |
| Point | operator* (const Precomputed &q) const DECAF_NOEXCEPT |
| Scalarmul-precomputed with scalar on left. | |
| SecureBuffer | direct_scalarmul (const FixedBlock< SER_BYTES > &in, decaf_bool_t allow_identity=DECAF_FALSE, decaf_bool_t short_circuit=DECAF_TRUE) const |
| Direct scalar multiplication. | |
| decaf_error_t DECAF_WARN_UNUSED | direct_scalarmul_noexcept (FixedBuffer< SER_BYTES > &out, const FixedBlock< SER_BYTES > &in, decaf_bool_t allow_identity=DECAF_FALSE, decaf_bool_t short_circuit=DECAF_TRUE) const DECAF_NOEXCEPT |
| Direct scalar multiplication. | |
Public Member Functions inherited from decaf::Serializable< Scalar > | |
| size_t | ser_size () const DECAF_NOEXCEPT |
| Return the number of bytes needed to serialize this object. | |
| void | serialize_into (unsigned char *buf) const DECAF_NOEXCEPT |
| Serialize this object into a buffer. | |
| SecureBuffer | serialize () const |
| Serialize this object into a SecureBuffer and return it. | |
Static Public Member Functions | |
| static decaf_error_t DECAF_WARN_UNUSED | decode (Scalar &sc, const FixedBlock< SER_BYTES > buffer) DECAF_NOEXCEPT |
| Decode from correct-length little-endian byte sequence. | |
Public Attributes | |
| Wrapped | s |
| access to the underlying scalar object | |
Static Public Attributes | |
| static const size_t | SER_BYTES = DECAF_255_SCALAR_BYTES |
| Size of a serialized element. | |
A scalar modulo the curve order.
Supports the usual arithmetic operations, all in constant time.
|
inlinestatic |
Decode from correct-length little-endian byte sequence.
|
inline |
Direct scalar multiplication.
| CryptoException | if the input didn't decode. |
|
inline |
Return half this scalar.
Much faster than /2.
|
inline |
Return 1/this.
| CryptoException | if this is 0. |
|
inline |
Invert with Fermat's Little Theorem (slow!).
If *this == 0, set r=0 and return DECAF_FAILURE.
Return this/q.
| CryptoException | if q == 0. |
Set this to this/q.
| CryptoException | if q == 0. |