Ejemplo n.º 1
0
        public unsafe bool Equals(StrongSum other)
        {
            if (alg != other.alg)
            {
                return(false);
            }

            if (sum == null)
            {
                return(other.sum == null);
            }

            if (sum.Length != other.sum.Length)
            {
                return(false);

                fixed(byte *t = sum)
                fixed(byte *o = other.sum)
                {
                    Debug.Assert(sum.Length == other.sum.Length);

                    for (var i = 0; i < sum.Length; i++)
                    {
                        if (t[i] != o[i])
                        {
                            return(false);
                        }
                    }
                }

                return(true);
        }
Ejemplo n.º 2
0
        void ISignatureProcessor.Chunk(uint weak, StrongSum strong)
        {
            var blockSign = new BlockSign(weak, strong)
            {
                Start  = position,
                Length = chunkSize
            };

            blocks.Add(blockSign);

            position += chunkSize;
        }
Ejemplo n.º 3
0
        public BlockSign LookupBlock(uint weak, StrongSum strong)
        {
            BlockSign block;

            if (blocks.TryGetValue(strong, out block))
            {
                return(block);
            }
            else
            {
                return(null);
            }
        }