public override int GetHashCode() { int hash = 1; if (Hash.Length != 0) { hash ^= Hash.GetHashCode(); } if (From.Length != 0) { hash ^= From.GetHashCode(); } if (To.Length != 0) { hash ^= To.GetHashCode(); } if (Value.Length != 0) { hash ^= Value.GetHashCode(); } if (Nonce != 0UL) { hash ^= Nonce.GetHashCode(); } if (Timestamp != 0L) { hash ^= Timestamp.GetHashCode(); } if (data_ != null) { hash ^= Data.GetHashCode(); } if (ChainId != 0) { hash ^= ChainId.GetHashCode(); } if (GasPrice.Length != 0) { hash ^= GasPrice.GetHashCode(); } if (GasLimit.Length != 0) { hash ^= GasLimit.GetHashCode(); } if (Alg != 0) { hash ^= Alg.GetHashCode(); } if (Sign.Length != 0) { hash ^= Sign.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public void GetHashCodeTest() { Random random = new Random(7777777); int length = 50; int repetitions = 50; for (int rep = 0; rep < repetitions; rep++) { Alg alg = Alg.FromRandomMoves(length, random); Alg clone = Alg.FromEnumerable(alg); Assert.AreEqual(alg.GetHashCode(), clone.GetHashCode()); } }