1#ifndef XRPL_CONDITIONS_PREIMAGE_SHA256_H
2#define XRPL_CONDITIONS_PREIMAGE_SHA256_H
4#include <xrpld/conditions/Condition.h>
5#include <xrpld/conditions/Fulfillment.h>
6#include <xrpld/conditions/detail/error.h>
8#include <xrpl/basics/Buffer.h>
9#include <xrpl/basics/Slice.h>
10#include <xrpl/protocol/digest.h>
15namespace cryptoconditions {
49 auto p = parsePreamble(s, ec);
53 if (!isPrimitive(p) || !isContextSpecific(p))
65 if (s.
size() != p.length)
77 auto b = parseOctetString(s, p.
length, ec);
108 return {d.
data(), d.size()};
Like std::vector<char> but better.
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.
An immutable linear range of bytes.
std::size_t size() const noexcept
Returns the number of bytes in the storage.
std::size_t length() const noexcept
bool validate(Slice) const override
Validates a fulfillment.
Buffer fingerprint() const override
Returns the fulfillment's fingerprint:
PreimageSha256(Buffer &&b) noexcept
static constexpr std::size_t maxPreimageLength
The maximum allowed length of a preimage.
Condition condition() const override
Returns the condition associated with the given fulfillment.
Type type() const override
Returns the type of this condition.
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.
PreimageSha256(Slice s) noexcept
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.