Post: Login Program
03-24-2013, 09:58 PM #1
Pichu
RIP PICHU.
(adsbygoogle = window.adsbygoogle || []).push({}); You must login or register to view this content.

Saw someone post a tutorial for a log in program. Here is my source, was about to write it after I commented on his/her thread but I had to go somewhere.

    
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;
using System.Security.Cryptography;


namespace Login
{
public partial class Login_Form : Form
{
public Login_Form()
{
InitializeComponent();
}


public MD5CryptoServiceProvider MD5 = new MD5CryptoServiceProvider();
public SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider();
public UTF8Encoding UTF8 = new UTF8Encoding();


string username, password, checkUsername, checkPassword;
private void Form1_Load(object sender, EventArgs e)
{
username = "F6605D694232FD462CC4147124DED870";
password = "A3B88082583ECCB947A2A77789589F26";
}


private void button1_Click(object sender, EventArgs e)
{
checkUsername = (BitConverter.ToString(MD5.ComputeHash(SHA1.ComputeHash((UTF8.GetBytes(textBox1.Text)))))).Replace("-", "");
checkPassword = (BitConverter.ToString(MD5.ComputeHash(SHA1.ComputeHash(UTF8.GetBytes(textBox2.Text))))).Replace("-", "");
if (username == checkUsername && password == checkPassword)
MessageBox.Show("Login Successful!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
else
MessageBox.Show("Incorrect Username or Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}


Creates a SHA1 hash and then a MD5 hash. You then set the desired username and password as the hashed values. This required then that the user must enter a username and password that is then hashed and equals to the already hashed username and password. This then prevents the user from just viewing the program source and retrieving the username/password and entering it in.

Obfuscating your code would also increase security.

Here is a download to the project file. The username is Pichu and the password is 1234.

You must login or register to view this content.
(adsbygoogle = window.adsbygoogle || []).push({});

The following user thanked Pichu for this useful post:

Master Ro
04-03-2013, 01:51 AM #11
Pichu
RIP PICHU.
Originally posted by another user
Might I ask what language this is in?


It is programmed in C#.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo