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: Extract the common hashing into one typed helper so changes to the ECDSA and Schnorr layouts stay synchronized.
Return the digest by value from the helper and public ComputeEntry* methods so callers explicitly initialize the cache entry, where the previous chained Finalize(entry.begin()) obscured the output assignment.
Document the existing layout and assert the valid ECDSA public-key encoding and 64-byte Schnorr signature requirements.
The serialized bytes and script validity rules are unchanged.