Exemplo n.º 1
0
        private void Decrypt(int characters, byte bit, int last = 0)
        {
            combination = new byte[255];
            bool   result = false;
            string check  = "";

            while (!result)
            {
                for (int i = 0; i <= characters; i++)
                {
                    for (int j = 32; j < 137; j++)
                    {
                        combination[i] = Convert.ToByte(j);

                        /*for (int k = 32; k < 137; k++)
                         * {
                         *  combination[1] = Convert.ToByte(k);*/
                        check  = System.Text.ASCIIEncoding.ASCII.GetString(combination);
                        result = BlowfishCrypter.CheckPassword(check, encrypted);
                        if (result)
                        {
                            break;
                        }
                        //}
                    }
                }
            }
            if (result)
            {
                endtime = DateTime.Now;
                MessageBox.Show("Started at: " + starttime.ToString() + " Ended at: " + endtime.ToString());
                MessageBox.Show("Decrypted pass: "******"Done with character nr " + characters.ToString();
                    MessageBox.Show("Done with character nr " + characters.ToString());
                    Decrypt(characters, bit, last);
                }
                else
                {
                    bit++;
                    Decrypt(characters, bit);
                }
            }
        }
        public User ValidateUser(string email, string password)
        {
            var user = ((IUserRepository)_repository).GetByMail(email);

            if (user == null)
            {
                return(null);
            }
            if (BlowfishCrypter.CheckPassword(password, user.Password))
            {
                return(user);
            }
            return(null);
        }