Ejemplo n.º 1
0
        public void Write(BinaryWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            PartialKey.Write(writer);
            EncryptedHeaderBlock.Write(writer);
            PlaintextHeaderBlock.Write(writer);

            writer.Write(B0Blocks.Count());

            foreach (var block in B0Blocks)
            {
                block.Write(writer);
            }

            writer.Write(SequentialBlocks.Count());

            foreach (var block in SequentialBlocks)
            {
                block.Write(writer);
            }
        }
Ejemplo n.º 2
0
        public override int GetHashCode()
        {
            var hashCode = 2040108761;

            hashCode = hashCode * -1521134295 + PartialKey.GetHashCode();
            hashCode = hashCode * -1521134295 + B0Blocks.Count().GetHashCode();
            hashCode = hashCode * -1521134295 + SequentialBlocks.Count().GetHashCode();
            return(hashCode);
        }
Ejemplo n.º 3
0
 public bool Equals(RecoveryState other)
 {
     if (other is null)
     {
         return(false);
     }
     else
     {
         return(PartialKey == other.PartialKey &&
                B0Blocks.Count() == other.B0Blocks.Count() &&
                SequentialBlocks.Count() == other.SequentialBlocks.Count());
     }
 }
Ejemplo n.º 4
0
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
        public int CompareTo(RecoveryState other)
        {
            int cmp = other.B0Blocks.Count() - B0Blocks.Count();

            if (cmp == 0)
            {
                cmp = other.SequentialBlocks.Count() - SequentialBlocks.Count();

                if (cmp == 0)
                {
                    cmp = PartialKey.CompareTo(other.PartialKey);
                }
            }

            return(cmp);
        }
Ejemplo n.º 5
0
 public override string ToString()
 {
     return($"RecoveryState({B0Blocks.Count()},{SequentialBlocks.Count()},{PartialKey.ToString()})");
 }