Esempio n. 1
0
        public Stream ConfigureStream(Stream decryptedDatabase)
        {

            Stream inputStream = new HashedBlockStream(decryptedDatabase, false, 0, false, _hasher);

            if (file.pwDatabase.Compression == PwCompressionAlgorithm.GZip)
            {
                inputStream = _gZipFactory.Decompress(inputStream);
            }
            return inputStream;

        }
        public Stream ConfigureStream(Stream source, PwCompressionAlgorithm compression, bool IsWritingStream)
        {
            Stream hashedBlockStream = source;

            if (IsWritingStream)
            {
                hashedBlockStream = new HashedBlockStream(source, true, new SHA256HasherRT());

                if (compression == PwCompressionAlgorithm.GZip)
                {
                    hashedBlockStream = new GZipStream(hashedBlockStream, CompressionMode.Compress);
                }
            }
            else
            {
                hashedBlockStream = new HashedBlockStream(source, false, 0, false, new SHA256HasherRT());

                if (compression == PwCompressionAlgorithm.GZip)
                {
                    hashedBlockStream = new GZipStream(hashedBlockStream, CompressionMode.Decompress);
                }
            }

            return hashedBlockStream;
        }
 public async Task HashedBlockStream()
 {
     
     var data = CryptographicBuffer.GenerateRandom(1024*1024).AsBytes();
     MemoryStream outStream = new System.IO.MemoryStream();
     var hashedBlockStream = new HashedBlockStream(outStream, true, new SHA256HasherRT());
     for (int i = 0; i < 1024 * 1024; i += 1024)
     {
         hashedBlockStream.Write(data, i, 1024);
     }
     hashedBlockStream.Flush();
     hashedBlockStream.Dispose();
     var fuckstick = outStream.ToArray();
 }
Esempio n. 4
0
        public Stream ConfigureStream(Stream stream)
        {
            //Stream inputStream = stream;
            Stream inputStream = new HashedBlockStream(stream,true,_hasher);

            if (kdb4File.pwDatabase.Compression == PwCompressionAlgorithm.GZip)
            {
                inputStream = _gZipFactory.Compress(inputStream);
            }
            return inputStream;
        }