Exemple #1
0
        public byte[] EncodeEBC(byte[] data)
        {
            ExpandData(ref data);
            var result = new List <byte>();

            for (int i = 0; i < data.Length; i += _algorithm.Size())
            {
                result.AddRange(_algorithm.EncodeBlok(data.Skip(i).Take(_algorithm.Size()).ToArray()));
            }
            encrypted_text = result;
            return(result.ToArray());
        }
Exemple #2
0
        public byte[] Encode(byte[] message)
        {
            var c = new List <byte>();

            for (int i = 0; i < message.Length; i += _algorithm.Size)
            {
                c.AddRange(_algorithm.EncodeBlok(message.Skip(i).Take(_algorithm.Size).ToArray()));
            }

            return(c.ToArray());
        }
Exemple #3
0
        public byte[] Encode(byte[] message)
        {
            var m = (byte[])message.Clone();
            var c = new List <byte>();

            byte[] prev = _c0;

            for (int i = 0; i < message.Length; i += _algorithm.Size)
            {
                c.AddRange(_algorithm.EncodeBlok(prev));
                prev = c.Skip(i).Take(_algorithm.Size).ToArray();
                for (int j = 0; j < _algorithm.Size; j++)
                {
                    c[i + j] ^= m[i + j];
                }
            }

            return(c.ToArray());
        }