Esempio n. 1
0
        public static byte[] DoEncrypt(byte[] input)
        {
            MemoryStream   ms   = new MemoryStream();
            TAHCryptStream s    = new TAHCryptStream(ms, input.Length);
            LZSSDeflate    lzss = new LZSSDeflate(s);

            lzss.Deflate(input);

            return(ms.ToArray());
        }
Esempio n. 2
0
        public static byte[] DoDecrypt(byte[] input, byte[] output)
        {
            TAHCryptStream s    = new TAHCryptStream(new MemoryStream(input, false), output.Length);
            LZSSInflate    lzss = new LZSSInflate(new MemoryStream(output, true));

            lzss.Inflate(s);

            if (lzss.InflatedSize != output.Length)
            {
                throw new InvalidDataException();
            }

            return(output);
        }