input_hash : TWO^32 |- S TWO^256 */
| 1208 | |
| 1209 | /* input_hash : TWO^32 |- S TWO^256 */ |
| 1210 | bool simplicity_input_hash(frameItem* dst, frameItem src, const txEnv* env) { |
| 1211 | uint_fast32_t i = simplicity_read32(&src); |
| 1212 | if (writeBit(dst, i < env->tx->numInputs)) { |
| 1213 | const sigInput* input = &env->tx->input[i]; |
| 1214 | sha256_midstate midstate; |
| 1215 | sha256_context ctx = sha256_init(midstate.s); |
| 1216 | if (input->isPegin) { |
| 1217 | sha256_uchar(&ctx, 1); |
| 1218 | sha256_hash(&ctx, &input->pegin); |
| 1219 | } else { |
| 1220 | sha256_uchar(&ctx, 0); |
| 1221 | } |
| 1222 | sha256_hash(&ctx, &input->prevOutpoint.txid); |
| 1223 | sha256_u32be(&ctx, input->prevOutpoint.ix); |
| 1224 | sha256_u32be(&ctx, input->sequence); |
| 1225 | if (input->hasAnnex) { |
| 1226 | sha256_uchar(&ctx, 1); |
| 1227 | sha256_hash(&ctx, &input->annexHash); |
| 1228 | } else { |
| 1229 | sha256_uchar(&ctx, 0); |
| 1230 | } |
| 1231 | sha256_finalize(&ctx); |
| 1232 | writeHash(dst, &midstate); |
| 1233 | } else { |
| 1234 | skipBits(dst, 256); |
| 1235 | } |
| 1236 | return true; |
| 1237 | } |
| 1238 | |
| 1239 | /* issuance_asset_amounts_hash : ONE |- TWO^256 */ |
| 1240 | bool simplicity_issuance_asset_amounts_hash(frameItem* dst, frameItem src, const txEnv* env) { |
nothing calls this directly
no test coverage detected