Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 public override void Add(BHash c)
 {
     byte[] bytes = c.ToBytes();
     AddBytes(bytes, 0, bytes.Length);
 }