MCPcopy Create free account
hub / github.com/ElementsProject/elements / simplicity_write_sha256_context

Function simplicity_write_sha256_context

src/simplicity/frame.c:175–180  ·  view source on GitHub ↗

Write data to a Simplicity CTX8 type (TWO^8)^<2^64 * TWO^64 * TWO^256 from a sha256_context value. * Advance the 'dst' frame to the end of the CTX8 type. * Returns false if the ctx had overflowed. * * The notation X^<2 is notation for the type (S X) * The notation X^<(2*n) is notation for the type S (X^n) * X^<n * * Precondition: '*dst' is a valid write frame for 838 more cells; *

Source from the content-addressed store, hash-verified

173 * ctx->counter < 2^61;
174 */
175bool simplicity_write_sha256_context(frameItem* dst, const sha256_context* ctx) {
176 simplicity_write_buffer8(dst, ctx->block, ctx->counter % 64, 5);
177 simplicity_write64(dst, ctx->counter >> 6);
178 write32s(dst, ctx->output, 8);
179 return !ctx->overflow;
180}
181
182/* Given a write frame and a read frame, copy 'n' cells from after the read frame's cursor to after the write frame's cursor,
183 * Cells in within the write frame beyond 'n' cells after the write frame's cursor may also be overwritten.

Calls 2

simplicity_write_buffer8Function · 0.85
write32sFunction · 0.85

Tested by

no test coverage detected