示例#1
0
        //Converts alphanumeric cipher to binary to original text.
        private string decompress(String compressedText, List <HuffLeafNode> leafNodePtrs)
        {
            CompressDepress deCompressor = new CompressDepress();                                     //Object to manage depression/compression.
            DAABitArray     deCompStream = deCompressor.decompressCipher(compressedText);             //Convert alphanumeric compressed text to binary stream.
            string          deCompString = deCompressor.decompressStream(deCompStream, leafNodePtrs); //Convert binary stream to text through Huffman tree.

            return(deCompString);
        }
示例#2
0
        //Converts binary stream to alphanumeric cipher.
        private string compress(DAABitArray binaryStream)
        {
            int             mod;
            CompressDepress compressor = new CompressDepress(); //Object to manage depression/compression.

            mod = binaryStream.NumBits % 6;                     //Test if divisible by 6.
            if (mod != 0)                                       //Pad bit stream with 0's until a multiple of 6.
            {
                for (int i = 0; i < 6 - mod; i++)
                {
                    binaryStream.Append(0);
                }
            }
            return(compressor.compress(binaryStream));
        }