Example #1
0
        void Main33(string[] args)
        {
            Crypto.A5_2 a5  = new A5_2();
            byte[]      key = a5.GenerateRandomKey();
            // byte[] iv = a5.GenerateRandomIV();

            a5.SetKey(key);
            // a5.SetIV(iv);

            String s = "Hellooo world!!!";

            byte[] input = System.Text.Encoding.ASCII.GetBytes(s);
            byte[] cript = a5.Crypt(input);

            Crypto.A5_2 a52 = new A5_2();
            a52.SetKey(key);
            //a52.SetIV(iv);
            byte[] decrypt = a52.Crypt(cript);
            String res     = System.Text.Encoding.ASCII.GetString(decrypt);

            RC4 rc4 = new RC4();

            byte[] iv = rc4.GenerateRandomIV();

            int counter = 1;

            // byte[] iv;
            byte[] output          = new byte[input.Length];
            int    IVCounterLength = iv.Count() + sizeof(int);

            byte[] ctr       = BitConverter.GetBytes(counter);
            byte[] IVCounter = { };
            IVCounter = IVCounter.Concat(iv).ToArray();
            IVCounter = IVCounter.Concat(ctr).ToArray();

            byte byte1 = 10;
            byte byte2 = 20;
            //  byte1[1] = byte1[1] ^ byte2[6];
            byte r = (byte)((byte1 >> 1 & 1) ^ (byte2 >> 6 & 1));

            byte[] b = System.Text.Encoding.ASCII.GetBytes("he lo");
            Console.WriteLine("Length: " + b.Count());
            Console.ReadLine();
        }
Example #2
0
 public byte[] RC4GenerateRandomIV()
 {
     return(rc4.GenerateRandomIV());
 }