rfcs / crypto-conditions

Composable cryptographic conditionals (signatures, hashes)
https://tools.ietf.org/html/draft-thomas-crypto-conditions-03
22 stars 12 forks source link

Clarify that PREIMAGE-SHA-256 conditions can be any length #6

Open justmoon opened 7 years ago

justmoon commented 7 years ago

Opening this issue on this repo as per https://github.com/interledger/rfcs/issues/148


From @nbougalis

By the way, the "PREIMAGE-SHA-256" spec is a bit unclear about what's allowed in a preimage:

This type of condition is also called a "hashlock". By creating a hash of a difficult-to-guess 256-bit random or pseudo-random integer it is possible to create a condition which the creator can trivially fulfill by publishing the random value. However, for anyone else, the condition is cryptographically hard to fulfill, because they would have to find a preimage for the given condition hash.

This seems to suggest that only a 256-bit random integer is valid input, but the rest of the spec suggests otherwise.

Whether the intent is to give a condition that's the SHA-256 hash of a uint256 the special name "hashlock" or to explicitly limit PREIMAGE-SHA-256 to only 256-bit fulfillment sizes, the text fails.

I'd suggest:

By choosing an appropriately large and difficult-to-guess string of bytes, it is possible to create a condition which the creator can trivially fulfill by publishing the string of bytes. However, for anyone else, the condition is cryptographically hard to fulfill, because they would have to find a preimage for the given condition condition hash. (edited)