Read data from a Simplicity CTX8 type (TWO^8)^<2^64 * TWO^64 * TWO^256 and fill in a sha256_context value. * Advance the 'src' frame to the end of the CTX8 type. * Returns false if the context's counter is too large (i.e. the compression count is greater than or equal to 2^55). * * 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
| 150 | * '*src' is a valid read frame for 838 more cells; |
| 151 | */ |
| 152 | bool simplicity_read_sha256_context(sha256_context* ctx, frameItem* src) { |
| 153 | size_t len; |
| 154 | uint_fast64_t compressionCount; |
| 155 | |
| 156 | simplicity_read_buffer8(ctx->block, &len, src, 5); |
| 157 | compressionCount = simplicity_read64(src); |
| 158 | ctx->counter = ((compressionCount*1U) << 6) + len; |
| 159 | read32s(ctx->output, 8, src); |
| 160 | ctx->overflow = (sha256_max_counter >> 6) <= compressionCount; |
| 161 | return !ctx->overflow; |
| 162 | } |
| 163 | |
| 164 | /* Write data to a Simplicity CTX8 type (TWO^8)^<2^64 * TWO^64 * TWO^256 from a sha256_context value. |
| 165 | * Advance the 'dst' frame to the end of the CTX8 type. |
no test coverage detected