Пример #1
0
        /// <summary>
        /// Determine whether a second bloom is possibly contained within the filter.
        /// </summary>
        /// <param name="bloom">The second bloom to test.</param>
        /// <returns>Whether this data could be contained within the filter.</returns>
        public bool Test(Bloom bloom)
        {
            var copy = new Bloom(bloom.ToBytes());

            copy.Or(this);
            return(Equals(copy));
        }
Пример #2
0
        /// <summary>
        /// Determine whether some input is possibly contained within the filter.
        /// </summary>
        /// <param name="test">The byte array to test.</param>
        /// <returns>Whether this data could be contained within the filter.</returns>
        public bool Test(byte[] test)
        {
            var compare = new Bloom();

            compare.Add(test);
            return(Test(compare));
        }
Пример #3
0
 /// <summary>
 /// Given this and another bloom, bitwise-OR all the data to get a bloom filter representing a range of data.
 /// </summary>
 public void Or(Bloom bloom)
 {
     for (int i = 0; i < data.Length; ++i)
     {
         data[i] |= bloom.data[i];
     }
 }
Пример #4
0
        public bool Equals(Bloom obj)
        {
            if (object.ReferenceEquals(obj, null))
            {
                return(false);
            }

            if (object.ReferenceEquals(this, obj))
            {
                return(true);
            }

            return(obj == this);
        }
Пример #5
0
 public SmartContractPoABlockHeader() : base()
 {
     hashStateRoot = 0;
     receiptRoot   = 0;
     logsBloom     = new Bloom();
 }