rippled
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | List of all members
ripple::cryptoconditions::PreimageSha256 Class Referencefinal
Inheritance diagram for ripple::cryptoconditions::PreimageSha256:
Inheritance graph
[legend]
Collaboration diagram for ripple::cryptoconditions::PreimageSha256:
Collaboration graph
[legend]

Public Member Functions

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

Static Public Member Functions

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

Static Public Attributes

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

Private Attributes

Buffer payload_
 

Detailed Description

Definition at line 34 of file PreimageSha256.h.

Constructor & Destructor Documentation

◆ PreimageSha256() [1/2]

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

Definition at line 105 of file PreimageSha256.h.

◆ PreimageSha256() [2/2]

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

Definition at line 109 of file PreimageSha256.h.

Member Function Documentation

◆ deserialize()

static std::unique_ptr<Fulfillment> ripple::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 55 of file PreimageSha256.h.

◆ type()

Type ripple::cryptoconditions::PreimageSha256::type ( ) const
overridevirtual

Returns the type of this condition.

Implements ripple::cryptoconditions::Fulfillment.

Definition at line 114 of file PreimageSha256.h.

◆ fingerprint()

Buffer ripple::cryptoconditions::PreimageSha256::fingerprint ( ) const
overridevirtual

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 ripple::cryptoconditions::Fulfillment.

Definition at line 120 of file PreimageSha256.h.

◆ cost()

std::uint32_t ripple::cryptoconditions::PreimageSha256::cost ( ) const
overridevirtual

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 ripple::cryptoconditions::Fulfillment.

Definition at line 129 of file PreimageSha256.h.

◆ condition()

Condition ripple::cryptoconditions::PreimageSha256::condition ( ) const
overridevirtual

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 ripple::cryptoconditions::Fulfillment.

Definition at line 135 of file PreimageSha256.h.

◆ validate()

bool ripple::cryptoconditions::PreimageSha256::validate ( Slice  data) const
overridevirtual

Validates a fulfillment.

Implements ripple::cryptoconditions::Fulfillment.

Definition at line 140 of file PreimageSha256.h.

Member Data Documentation

◆ maxPreimageLength

constexpr std::size_t ripple::cryptoconditions::PreimageSha256::maxPreimageLength = 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 46 of file PreimageSha256.h.

◆ payload_

Buffer ripple::cryptoconditions::PreimageSha256::payload_
private

Definition at line 102 of file PreimageSha256.h.

◆ maxSerializedFulfillment

constexpr std::size_t ripple::cryptoconditions::Fulfillment::maxSerializedFulfillment = 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 41 of file Fulfillment.h.