Ejemplo n.º 1
0
        public static void ENCRYPTION_TESTING()
        {
            string original = "the goyim know too much" + EOT
                              + "Everything here is make believe, only a fool would take it seriously." + EOT
                              + "Don't worry, it's just fake news" + EOT
                              + "SPIRIT COOKING" + EOT
                              + "its like annudah shoah" + EOT
                              + "SHUT IT DOWN THE GOYIM KNOW" + EOT
                              + "dissenter is banned" + EOT
                              + "I'm running out of ideas, all I can do is type shitty /pol/ memes" + EOT
            ;


            //string[] multiSendDrifting = original.Split(EOT);
            List <byte[]> wew       = new List <byte[]>();
            int           stringpos = 0;
            SRNG          rand      = new SRNG();

            while (stringpos < original.Length)
            {
                int next = stringpos + rand.NextInt(2, 47);
                if (next > original.Length)
                {
                    next = original.Length;
                }
                int    diff = next - stringpos;
                string cut  = original.Substring(stringpos, diff);
                stringpos = next;

                Debug.Log("Cut " + cut, "cyan");
                wew.Add(cut.ToBytesUTF8());
            }

            byte[][]      multibytarraydrifting = wew.ToArray();
            EncDec        encDec = new EncDec();
            StringBuilder held   = "";
            string        str;
            int           pos = 0;

            Debug.Log("Faking sending bullshit", "purp");
            foreach (var bytes in multibytarraydrifting)
            {
                byte[] message = encDec.Encrypt(bytes);
                Debug.Log("Encrypting " + message.Length + " bytes");
                message = encDec.Decrypt(message);
                str     = message.GetStringUTF8();

                Debug.Log("Sent [" + str.Replace("" + EOT, "<EOT>") + "]", "yellow");

                held += str;
                int index = held.IndexOf(EOT);
                while (index >= 0)
                {
                    string pulled = held.Substring(0, index);
                    held  = held.Remove(0, index + 1);
                    index = held.IndexOf(EOT);

                    if (pulled.Length > 0)
                    {
                        Debug.Log("Pulled message " + pos + ": " + pulled, "ltorange");
                    }
                    //TBD: Pass the message to a location for it to be handled, something like the following line
                    //Server.main.messages.Enqueue(new Message(this, pulled));
                }
                pos++;
            }
            //*/
        }
Ejemplo n.º 2
0
 public static int Range(int min, int max)
 {
     return(rng.NextInt(min, max));
 }