Solidity Hash of Structs (Testing hash uniqueness)
So ive been informed by one of my Advisee ( Rain de Castro ) that when hashing a Struct in Solidity, the hash is the same for 2 data that is different. So i did a few tests with the following Code pragma solidity ^0.4.0; contract testHashAresh{ //Declare a struct similar to C++ struct Person{ string fullName; string number; } mapping (bytes32 => Person) allPersons; function returnHash(string _name, string _time) constant returns (bytes32,bytes32) { Person memory p = Person(_name, _time); bytes32 hash2 = sha256(p); bytes32 hash = sha256(_name, _time); return (hash2, hash); } } True enough The returned value for a data "Aresh","555" 0: bytes32: 0xac9c046be90fd91b4a31b9d04bb937659e885264dd8e6b8a7c9e79b806ef3ead 1: bytes32: 0x5ffc903b2aee670ea38ec2c35a8c5b8ac04754cf77536dd89d4d9985c4fd110f while the data for "Armin","555" is 0: bytes32