Exemple #1
0
        public FileStreamPseudoRandomGenerator(FileStream stream, PseudoRandomGenerator generator, string recycleKey, byte[] seedKey, byte[] SHASeedKey, int leftoff)
        {
            writer = new BinaryWriter(stream);
            reader = new BinaryReader(stream);

            this.seedKey    = seedKey;
            this.SHASeedKey = SHASeedKey;
            this.recycleKey = recycleKey;

            generator.WriteToFile(writer);
            generator.Drop();
            this.leftoff = leftoff;

            this.numberOfChunks = stream.Length / CHUNK_SIZE;

            if (stream.Length % CHUNK_SIZE != 0)
            {
                this.numberOfChunks++;
                this.lastChunkSize = stream.Length % CHUNK_SIZE;
            }
            else
            {
                this.lastChunkSize = CHUNK_SIZE;
            }

            writer.BaseStream.Position = 0;
        }
        public FileStreamPseudoRandomGenerator(FileStream stream, PseudoRandomGenerator generator, string recycleKey, byte[] seedKey, byte[] SHASeedKey, int leftoff)
        {
            writer = new BinaryWriter(stream);
            reader = new BinaryReader(stream);

            this.seedKey = seedKey;
            this.SHASeedKey = SHASeedKey;
            this.recycleKey = recycleKey;

            generator.WriteToFile(writer);
            generator.Drop();
            this.leftoff = leftoff;

            this.numberOfChunks = stream.Length / CHUNK_SIZE;

            if (stream.Length % CHUNK_SIZE != 0)
            {
                this.numberOfChunks++;
                this.lastChunkSize = stream.Length % CHUNK_SIZE;
            }
            else
                this.lastChunkSize = CHUNK_SIZE;

            writer.BaseStream.Position = 0;
        }
Exemple #3
0
 /// <summary>
 /// Drops the keys.
 /// </summary>
 override public void Drop()
 {
     ended = true;
     Key1.Drop();
     Key2.Drop();
 }