BIP-375's test runner does not check the signatures in the test vectors, so master's vectors pass although only one of their 43 signatures verifies. This PR adds bip-0375/signatures.py, which the runner applies to every vector. signatures.py checks that each P2PKH, P2WPKH and P2SH-P2WPKH program commits to its input's keys, that a P2SH program commits to its redeem script, that each sighash byte matches PSBT_IN_SIGHASH_TYPE where that field is set, and that each signature verifies. A signature whose sighash cannot be computed, such as one on a segwit v2 input, counts as a failure, not a skip. An input without its spent output, or a P2SH input without its redeem script, is skipped: rejecting such a PSBT is the validator's job, which #2324 makes it do. The validator is unchanged.
This PR depends on #2316, which fixes the vectors, and contains its three commits; the last three commits are this PR's own. With #2316's vectors the runner reports 44 passed; with master's, 39 of 44 fail. hash160 now uses a copy of bip-0352/ripemd160.py, because hashlib lacks RIPEMD-160 on some systems, as #1616 found for BIP-352. The version is the 0.1.5 that #2316 sets, and the last commit adds this PR's line to its changelog entry; 0.1.6 is #2324's, and whichever of #2316 and #2324 lands second rebases its version if needed.
Made with my usual tools: a computer, the Internet and an LLM. The mistakes, as usual, are all mine.