0
In various places on Ripple Wiki we can see the type Hash256 (for example here). What data structure is it exactly? Is it just a 256 byte array, or are there some rules governing this type (and preventing potential misuse)?
0
In various places on Ripple Wiki we can see the type Hash256 (for example here). What data structure is it exactly? Is it just a 256 byte array, or are there some rules governing this type (and preventing potential misuse)?
2
The Hash256 is essentially a uint256. However, after reading through much of the wiki and source, it appears that the Hash256 type is meant to be a generic, unsigned integer type that can store any form of hash that is larger than 128 bits.
As an example, all hashes mentioned in the Tree Formats portion of the wiki are stored in Hash256 fields. Some are 256-bits (I think?) while other mentioned hashes are 160-bit hashes that are padded with 0's.
As an aside, I also noticed that when working with 256-bit hashes, Ripple often uses the first 256-bits of SHA-512 hash. This is different than the typical SHA-256 hashes that are used with Bitcoin and most other alt-coins.
NOTE: I know that a few of the Ripple devs participate in this site. I would be greatly interested in their input. The wiki and the source is quite cryptic in design-- almost obfuscated. I had to follow quite a few rabbit trails to come up with the answer that I've provided.
1Everything you have said above is correct. Except the tree indexes are always actual 256-bit hashes. For example, the 256-bit index for an account root node is the 256-bit hash of a 16-bit "space identifier" followed by the 160-bit account ID. – David Schwartz – 2013-10-26T05:03:17.433
It's a 256 bit hash. – dchapes – 2013-10-24T11:39:21.763
perhaps the same thing Bitcoin calls Hash256: SHA256(SHA256(x)) – CodesInChaos – 2013-10-25T12:05:42.303