public void TestSaltCopy() { Salt s = new Salt(); byte[] bytes = new byte[s.Length]; s.CopyTo(bytes, 0); Assert.AreEqual(s.ToArray(), bytes); Assert.AreEqual(s.GetHashCode(), Salt.FromBytes(bytes).GetHashCode()); Salt strcpy = Salt.FromString(s.ToString()); Assert.AreEqual(s.ToArray(), strcpy.ToArray()); Assert.AreEqual(s.ToString(), strcpy.ToString()); Assert.AreEqual(s.GetHashCode(), strcpy.GetHashCode()); }
public override int GetHashCode() { int hash = 1; if (OwnerID.Length != 0) { hash ^= OwnerID.GetHashCode(); } if (Salt.Length != 0) { hash ^= Salt.GetHashCode(); } if (Capacity != 0UL) { hash ^= Capacity.GetHashCode(); } if (rules_ != null) { hash ^= Rules.GetHashCode(); } if (BasicACL != 0) { hash ^= BasicACL.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public void TestEquality() { Salt s = new Salt(); Salt scopy = Salt.FromBytes(s.ToArray()); Assert.AreEqual(s, scopy); Assert.IsTrue(s.Equals(scopy)); Assert.IsTrue(s.Equals((object)scopy)); Assert.IsTrue(s == scopy); Assert.IsFalse(s != scopy); Assert.AreEqual(s.GetHashCode(), scopy.GetHashCode()); scopy = new Salt(); Assert.AreNotEqual(s, scopy); Assert.IsFalse(s.Equals(scopy)); Assert.IsFalse(s.Equals((object)scopy)); Assert.IsFalse(s == scopy); Assert.IsTrue(s != scopy); Assert.AreNotEqual(s.GetHashCode(), scopy.GetHashCode()); }
public override int GetHashCode() { unchecked { int hashCode = Id.GetHashCode(); hashCode = (hashCode * 397) ^ (Ciphertext != null ? Ciphertext.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (InitializationVector != null ? InitializationVector.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Salt != null ? Salt.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Deleted.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = Hash != null ? Hash.GetHashCode() : 0; hashCode = (hashCode * 397) ^ (Salt != null ? Salt.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Iterations; hashCode = (hashCode * 397) ^ Prf.GetHashCode(); return(hashCode); } }