20 #ifndef RIPPLE_CONDITIONS_PREIMAGE_SHA256_H
21 #define RIPPLE_CONDITIONS_PREIMAGE_SHA256_H
23 #include <ripple/basics/Buffer.h>
24 #include <ripple/basics/Slice.h>
25 #include <ripple/conditions/Condition.h>
26 #include <ripple/conditions/Fulfillment.h>
27 #include <ripple/conditions/impl/error.h>
28 #include <ripple/protocol/digest.h>
32 namespace cryptoconditions {
66 auto p = parsePreamble(s, ec);
70 if (!isPrimitive(p) || !isContextSpecific(p))
82 if (s.
size() != p.length)
94 auto b = parseOctetString(s, p.
length, ec);
98 return std::make_unique<PreimageSha256>(std::move(b));
125 return {d.
data(), d.size()};
std::size_t size() const noexcept
Returns the number of bytes in the storage.
An immutable linear range of bytes.
bool validate(Slice) const override
Validates a fulfillment.
std::size_t length() const noexcept
Like std::vector<char> but better.
Buffer fingerprint() const override
Returns the fulfillment's fingerprint:
static std::unique_ptr< Fulfillment > deserialize(Slice s, std::error_code &ec)
Parse the payload for a PreimageSha256 condition.
std::uint32_t cost() const override
Calculates the cost associated with this fulfillment.
std::size_t size() const noexcept
Returns the number of bytes in the buffer.
std::uint8_t const * data() const noexcept
Return a pointer to beginning of the storage.
Condition condition() const override
Returns the condition associated with the given fulfillment.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
PreimageSha256(Buffer &&b) noexcept
Type type() const override
Returns the type of this condition.
PreimageSha256(Slice s) noexcept
static constexpr std::size_t maxPreimageLength
The maximum allowed length of a preimage.