Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace TestLogin
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void exit_Click(object sender, EventArgs e)
- {
- Application.Exit();
- }
- private void login_Click(object sender, EventArgs e)
- {
- // Variable declaration
- string user = username.Text;
- string pass = password.Text;
- string epass = pass;
- string SearchValue = "1000111001111011110011100100001000011000011000011";
- //int x = 8;
- list.Items.Clear();
- // A is swopped with 0, b is swopped with 1 etc (binary). The arrays to compare.
- String[] chars = new string[26] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
- String[] nums = new string[26] { "0", "1", "10", "11", "100", "101", "111", "1000", "1001", "1011", "1111", "10000", "10001", "10011", "10111", "11111", "100000",
- "100001", "100011", "100111", "101111", "111111", "1000000", "1000001", "1000011", "1000111" };
- // While we have not proccessed all the letters
- for (int i = 0; i < 26; i++)
- {
- // Debug
- list.Items.Add("i = " + i + "; chars = " + chars[i] + "; nums = " + nums[i] + ";");
- // Important part
- epass = epass.Replace(chars[i], nums[i]);
- // Debug
- list.Items.Add(epass);
- // Were not mean enough to implement this
- /*if (epass.Length >= x)
- {
- epass = epass.Insert(x, " ");
- x = x * 2;
- }*/
- }
- // If it's what were looking for but not the literal
- if (user.Equals("admin") && epass.Equals(SearchValue) && !pass.Equals(SearchValue))
- {
- success.Text = "Correct login.";
- login.Enabled = false;
- username.Enabled = false;
- password.Enabled = false;
- list.Items.Clear();
- list.Items.Add("You win! The password was: stoneharry");
- passcode.Text = "Pass Code: stoneharry";
- }
- else
- {
- success.Text = "Incorrect details.";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment