Problem: Signature-cache hashing relies on input requirements that are implicit at its public entry methods.
Inspired by the Elements rangeproof-cache vulnerability behind the recent Liquid incident and the subsequent cache-key fix, this change clarifies an easy-to-misread hashing pattern: Write(data, size) hashes the data bytes without encoding the size.
Bitcoin Core's cache keys already include the signature hash, public key, and signature in separate ECDSA and Schnorr domains.
Bitcoin Core's signature-cache encoding is unambiguous for inputs accepted by its current script checker: a valid ECDSA public key's prefix determines its length, while a Schnorr public key is always 32 bytes, leaving the signature as the remaining suffix.
Fix: Use native HashWriter serialization in the typed ComputeEntry* methods so ECDSA public keys and signature vectors include their CompactSize lengths.
Schnorr retains its fixed-size public-key encoding and raw signature span.
Return the digest by value from the public ComputeEntry* methods so callers explicitly initialize the cache entry, where the previous chained Finalize(entry.begin()) obscured the output assignment.
Keep the prepared salt prefixes private and const, and copy them locally for each entry.
Retain the ECDSA salt padding and drop the Schnorr salt padding.
Add a nonce-taking constructor so tests can reproduce the encoding deterministically.
The process-local cache-entry bytes change, while script validity rules are unchanged.