annex_hash : CTX8 * S TWO^256 |- CTX8 */
| 984 | |
| 985 | /* annex_hash : CTX8 * S TWO^256 |- CTX8 */ |
| 986 | bool simplicity_annex_hash(frameItem* dst, frameItem src, const txEnv* env) { |
| 987 | (void) env; // env is unused. |
| 988 | sha256_midstate midstate; |
| 989 | unsigned char buf[32]; |
| 990 | sha256_context ctx = {.output = midstate.s}; |
| 991 | |
| 992 | /* Read a SHA-256 context. */ |
| 993 | if (!simplicity_read_sha256_context(&ctx, &src)) return false; |
| 994 | |
| 995 | /* Read an optional hash. (257 bits) */ |
| 996 | if (readBit(&src)) { |
| 997 | /* Read a hash. (256 bits) */ |
| 998 | read8s(buf, 32, &src); |
| 999 | sha256_uchar(&ctx, 0x01); |
| 1000 | sha256_uchars(&ctx, buf, 32); |
| 1001 | } else { |
| 1002 | /* No hash. */ |
| 1003 | sha256_uchar(&ctx, 0x00); |
| 1004 | } |
| 1005 | |
| 1006 | return simplicity_write_sha256_context(dst, &ctx); |
| 1007 | } |
| 1008 | |
| 1009 | /* issuance : TWO^256 |- S (S TWO) */ |
| 1010 | bool simplicity_issuance(frameItem* dst, frameItem src, const txEnv* env) { |
nothing calls this directly
no test coverage detected