outpoint_hash : CTX8 * S TWO^256 * TWO^256 * TWO^32 |- CTX8 */
| 872 | |
| 873 | /* outpoint_hash : CTX8 * S TWO^256 * TWO^256 * TWO^32 |- CTX8 */ |
| 874 | bool simplicity_outpoint_hash(frameItem* dst, frameItem src, const txEnv* env) { |
| 875 | (void) env; // env is unused. |
| 876 | sha256_midstate midstate; |
| 877 | unsigned char buf[36]; |
| 878 | sha256_context ctx = {.output = midstate.s}; |
| 879 | |
| 880 | /* Read a SHA-256 context. */ |
| 881 | if (!simplicity_read_sha256_context(&ctx, &src)) return false; |
| 882 | |
| 883 | /* Read an optional pegin parent chain hash. */ |
| 884 | if (readBit(&src)) { |
| 885 | /* Read a pegin parent chain hash. */ |
| 886 | read8s(buf, 32, &src); |
| 887 | sha256_uchar(&ctx, 0x01); |
| 888 | sha256_uchars(&ctx, buf, 32); |
| 889 | } else { |
| 890 | /* No pegin. */ |
| 891 | sha256_uchar(&ctx, 0x00); |
| 892 | forwardBits(&src, 256); |
| 893 | } |
| 894 | |
| 895 | /* Read an outpoint (hash and index). */ |
| 896 | read8s(buf, 36, &src); |
| 897 | sha256_uchars(&ctx, buf, 36); |
| 898 | |
| 899 | return simplicity_write_sha256_context(dst, &ctx); |
| 900 | } |
| 901 | |
| 902 | /* asset_amount_hash : CTX8 * Conf TWO^256 * Conf TWO^64 |- CTX8 */ |
| 903 | bool simplicity_asset_amount_hash(frameItem* dst, frameItem src, const txEnv* env) { |
nothing calls this directly
no test coverage detected