xrpld
Loading...
Searching...
No Matches
xrpl::cryptoconditions::PreimageSha256 Class Referencefinal

#include <PreimageSha256.h>

Inheritance diagram for xrpl::cryptoconditions::PreimageSha256:
Collaboration diagram for xrpl::cryptoconditions::PreimageSha256:

Public Member Functions

 PreimageSha256 (Buffer &&b) noexcept
 PreimageSha256 (Slice s) noexcept
Type type () const override
 Returns the type of this condition.
Buffer fingerprint () const override
 Returns the fulfillment's fingerprint:
std::uint32_t cost () const override
 Calculates the cost associated with this fulfillment.
Condition condition () const override
 Returns the condition associated with the given fulfillment.
bool validate (Slice) const override
 Validates a fulfillment.

Static Public Member Functions

static std::unique_ptr< Fulfillmentdeserialize (Slice s, std::error_code &ec)
 Parse the payload for a PreimageSha256 condition.

Static Public Attributes

static constexpr std::size_t kMaxPreimageLength = 128
 The maximum allowed length of a preimage.
static constexpr std::size_t kMaxSerializedFulfillment = 256
 The largest binary fulfillment we support.

Private Attributes

Buffer payload_

Detailed Description

Definition at line 14 of file PreimageSha256.h.

Constructor & Destructor Documentation

◆ PreimageSha256() [1/2]

xrpl::cryptoconditions::PreimageSha256::PreimageSha256 ( Buffer && b)
noexcept

Definition at line 85 of file PreimageSha256.h.

◆ PreimageSha256() [2/2]

xrpl::cryptoconditions::PreimageSha256::PreimageSha256 ( Slice s)
noexcept

Definition at line 89 of file PreimageSha256.h.

Member Function Documentation

◆ deserialize()

std::unique_ptr< Fulfillment > xrpl::cryptoconditions::PreimageSha256::deserialize ( Slice s,
std::error_code & ec )
static

Parse the payload for a PreimageSha256 condition.

Parameters
sA slice containing the DER encoded payload
ecindicates success or failure of the operation
Returns
the preimage, if successful; empty pointer otherwise.

Definition at line 35 of file PreimageSha256.h.

◆ type()

Type xrpl::cryptoconditions::PreimageSha256::type ( ) const
nodiscardoverridevirtual

Returns the type of this condition.

Implements xrpl::cryptoconditions::Fulfillment.

Definition at line 94 of file PreimageSha256.h.

◆ fingerprint()

Buffer xrpl::cryptoconditions::PreimageSha256::fingerprint ( ) const
nodiscardoverridevirtual

Returns the fulfillment's fingerprint:

The fingerprint is an octet string uniquely representing this fulfillment's condition with respect to other conditions of the same type.

Implements xrpl::cryptoconditions::Fulfillment.

Definition at line 100 of file PreimageSha256.h.

◆ cost()

std::uint32_t xrpl::cryptoconditions::PreimageSha256::cost ( ) const
nodiscardoverridevirtual

Calculates the cost associated with this fulfillment.

  • The cost function is deterministic and depends on the type and properties of the condition and the fulfillment that the condition is generated from.

Implements xrpl::cryptoconditions::Fulfillment.

Definition at line 109 of file PreimageSha256.h.

◆ condition()

Condition xrpl::cryptoconditions::PreimageSha256::condition ( ) const
nodiscardoverridevirtual

Returns the condition associated with the given fulfillment.

This process is completely deterministic. All implementations will, if compliant, produce the identical condition for the same fulfillment.

Implements xrpl::cryptoconditions::Fulfillment.

Definition at line 115 of file PreimageSha256.h.

◆ validate()

bool xrpl::cryptoconditions::PreimageSha256::validate ( Slice data) const
nodiscardoverridevirtual

Validates a fulfillment.

Implements xrpl::cryptoconditions::Fulfillment.

Definition at line 121 of file PreimageSha256.h.

Member Data Documentation

◆ kMaxPreimageLength

std::size_t xrpl::cryptoconditions::PreimageSha256::kMaxPreimageLength = 128
staticconstexpr

The maximum allowed length of a preimage.

The specification does not specify a minimum supported length, nor does it require all conditions to support the same minimum length.

While future versions of this code will never lower this limit, they may opt to raise it.

Definition at line 26 of file PreimageSha256.h.

◆ payload_

Buffer xrpl::cryptoconditions::PreimageSha256::payload_
private

Definition at line 82 of file PreimageSha256.h.

◆ kMaxSerializedFulfillment

std::size_t xrpl::cryptoconditions::Fulfillment::kMaxSerializedFulfillment = 256
staticconstexprinherited

The largest binary fulfillment we support.

Note
This value will be increased in the future, but it must never decrease, as that could cause fulfillments that were previously considered valid to no longer be allowed.

Definition at line 19 of file Fulfillment.h.