예제 #1
0
        public byte[] Encode(byte[] data)
        {
            if (enc == null)
            {
                return(data);
            }

            byte[] result = new byte[data.Length];
            for (int i = 0; i < data.Length; i++)
            {
                result[i] = enc.Encode(data[i]);
            }

            return(result);
        }
예제 #2
0
        public byte[] Decode(byte[] buffer, int length)
        {
            byte[] data = new byte[length];

            Buffer.BlockCopy(buffer, 0, data, 0, length);

            if (dec == null || mppc == null)
            {
                return(data);
            }


            foreach (byte bt in data)
            {
                decBuffer.WriteBytes(mppc
                                     .Unpack(dec
                                             .Encode(bt)));
            }

            data = decBuffer.GetBytes();
            decBuffer.Clear();

            return(data);
        }