MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / HashedSourceWriter

Class HashedSourceWriter

src/hash.h:192–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190/** Writes data to an underlying source stream, while hashing the written data. */
191template <typename Source>
192class HashedSourceWriter : public HashWriter
193{
194private:
195 Source& m_source;
196
197public:
198 explicit HashedSourceWriter(Source& source LIFETIMEBOUND) : HashWriter{}, m_source{source} {}
199
200 void write(std::span<const std::byte> src)
201 {
202 m_source.write(src);
203 HashWriter::write(src);
204 }
205
206 template <typename T>
207 HashedSourceWriter& operator<<(const T& obj)
208 {
209 ::Serialize(*this, obj);
210 return *this;
211 }
212};
213
214/** Single-SHA256 a 32-byte input (represented as uint256). */
215[[nodiscard]] uint256 SHA256Uint256(const uint256& input);

Callers

nothing calls this directly

Calls 1

SerializeFunction · 0.70

Tested by

no test coverage detected