Score:0

Is it impossible to extract any data from an ECDSA signature of hashed data

md flag

I am trying to write a function that, given an EIP712 ECDSA signature, verifies the signature was signed by a particular person, and then (somehow) retrieves the information that is encoded in the signature.

Is it even possible to retrieve the unhashed data from an EIP712 ECDSA signature, or is it only possible to verify the data that the signature contains, by already having this data in an unhashed format, and using ecrecover to verify the signer of the data?

Marc Ilunga avatar
tr flag
In the general case, hashes may be hard to reverse. As explained here https://crypto.stackexchange.com/a/56136/58690, the question is unlikely to have a feasible solution. But if the message is from a small set, you could perhaps brute force the original message.
Score:2
in flag

The signature defined consists of a set of encoding rules which specify how the data is fed into the signature algorithm.

From the page about EIP712 we can see that:

The encoding is compliant with EIP-191. The ‘version byte’ is fixed to 0x01, the ‘version specific data’ is the 32-byte domain separator domainSeparator and the ‘data to sign’ is the 32-byte hashStruct(message).

where

hashStruct(s : ) = keccak256(typeHash ‖ encodeData(s)) where typeHash = keccak256(encodeType(typeOf(s)))

Here keccak256 is a cryptographically secure hash, which is irreversible. So for that reason you'd only be able to guess the data that was hashed, and then verify the signature using that. You cannot retrieve any information from the signature itself.

This is a normal property for most signatures, although there are RSA based signature schemes that allow (partial) message recovery.

Barney Chambers avatar
md flag
Cool. thank you for the detailed explanation, this is what I thought
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.