public override int CompareTo(BHash other) { int ret = 1; if (other != null) { BHash bh = other as BHashBytes; if (bh != null) { byte[] otherb = bh.ToBytes(); if (_hash.Length != otherb.Length) { ret = _hash.Length.CompareTo(otherb.Length); } else { ret = 0; // start off assuming they are equal for (int ii = 0; ii < _hash.Length; ii++) { ret = _hash[ii].CompareTo(otherb[ii]); if (ret != 0) { break; } } } } } return(ret); }
public override bool Equals(BHash other) { bool ret = false; if (other != null) { BHash bh = other as BHashBytes; if (bh != null) { ret = _hash.Equals(bh.ToBytes()); } } return(ret); }
public override void Add(BHash c) { byte[] bytes = c.ToBytes(); AddBytes(bytes, 0, bytes.Length); }