Exemplo n.º 1
0
        internal virtual void GeneratePWD(string pwd)
        {
            int          i;
            IList <byte> temp = new List <byte>();

            byte[] tmp;
            tmp = System.Text.Encoding.Default.GetBytes(pwd);
            hasher.Reset();
            hasher.Update(tmp);
            foreach (byte b in tmp)
            {
                temp.Add(b);
            }
            tmp = BitConverter.GetBytes(hasher.Value);
            foreach (byte b in tmp)
            {
                temp.Add(b);
            }
            for (i = 0; i < 128; i++)
            {
                if (i < temp.Count)
                {
                    m_key[i] = (byte)(temp[i] ^ WhisperTable[temp[i % temp.Count] % 64]);
                }
                else
                {
                    m_key[i] = (byte)((m_key[(i + 1) % temp.Count] & 0xc0 | m_key[(i + 3) % temp.Count] & 0x30 | m_key[i % temp.Count] & 0x0c | m_key[(i + 2) % temp.Count] & 0x03) ^ WhisperTable[temp[i % temp.Count] % 64]);
                }
            }
            hasher.Reset();
            hasher.Update(m_key);
            m_seed = (int)hasher.Value;
            KBox.initkbox(m_seed);
        }
Exemplo n.º 2
0
        static void Start()
        {
            KBox b = new KBox();

            b.Title = " PopUp | MAIN MENU ";
            b.Text  = "                          " +
                      "                       " +
                      "[q][Enter] for [Q]uit." +
                      "                          " +
                      "[t][Enter] for [T]ool.";
            b.PosX   = 2;
            b.PosY   = 1;
            b.Width  = 48;
            b.Height = 6;

            KBox LeftResultBox = new KBox();

            LeftResultBox.Title           = "";
            LeftResultBox.Text            = " Welcome! Follow the menu above.";
            LeftResultBox.DarkColor       = Kolor.DARK_GREEN;
            LeftResultBox.LightColor      = Kolor.DARK_YELLOW;
            LeftResultBox.BackgroundColor = Kolor.YELLOW;
            LeftResultBox.Width           = 48;
            LeftResultBox.Height          = 2;
            //LeftResultBox.PosX = b.PosX + b.Width + 5;
            LeftResultBox.PosY = b.Height + b.PosY + LeftResultBox.Height + 2;


            LeftResultBox.Draw();
            b.Draw();

            string VALID_OPTIONS = "qt";
            string _Input        = "";

            while (!VALID_OPTIONS.Contains(_Input) || _Input == "")
            {
                _Input =
                    Konsole.AskLine(true, b.BotPosX, b.BotPosY,
                                    " >", Kolor.DARK_MAGENTA, Kolor.WHITE,
                                    Kolor.DARK_MAGENTA, Kolor.WHITE);

                Konsole.CursorX = b.PosX + b.Width + 6;
                Konsole.CursorY = 1;

                if (!VALID_OPTIONS.Contains(_Input) || _Input == "")
                {
                    LeftResultBox.Text = " <|º_º|> Invalid option.";
                }
                //Konsole.InLine("<|º_º|> Invalid option.", Kolor.DARK_GRAY);
                LeftResultBox.Draw();
                b.Draw();
            }


            switch (_Input.ToLower())
            {
            case "q":
                Konsole.Clear();
                Konsole.AskLine(false, 1, Konsole.Height - 2,
                                " > Press [ENTER] to exit the application.",
                                Kolor.CYAN, Kolor.DARK_MAGENTA, Kolor.DARK_MAGENTA, Kolor.DARK_MAGENTA);
                Environment.Exit(42);

                break;

            case "t":
                Konsole.Clear();
                Tool();
                break;
            }

            b = null;
        }