All pastes #982454 Raw Edit

HARREN

public text v1 · immutable
·published 2008-04-12 16:04 UTC
rendered paste body
using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using System.Security.Cryptography;

using System.IO;



namespace MD5_app

{

    public partial class Form1 : Form

    {

        public string hash;

        public string source;

        public string hashOne;

        public string harren;

        public Form1()

        {

            InitializeComponent();

        }



        

            static string getMd5Hash(string input)

            {

                

                MD5 md5Hasher = MD5.Create();



               

                byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input));



                

                StringBuilder sBuilder = new StringBuilder();



                

                for (int i = 0; i < data.Length; i++)

                {

                    sBuilder.Append(data[i].ToString("x2"));

                }



                

                return sBuilder.ToString();

            }



            

            static bool verifyMd5Hash(string input, string hash)

            {

                

                string hashOfInput = getMd5Hash(input);



                

                StringComparer comparer = StringComparer.OrdinalIgnoreCase;



                if (0 == comparer.Compare(hashOfInput, hash))

                {

                    return true;

                }

                else

                {

                    return false;

                }



            

            





            



        }



        private void button1_Click(object sender, EventArgs e)

        {

            harren = textBox1.Text;

            textBox1.Text = "";

            textBox1.Text += harren + ":";

            source = harren;



            hash = getMd5Hash(source);



            textBox1.Text += " " + hash;

            

        }



        private void button2_Click(object sender, EventArgs e)

        {

            hashOne = textBox1.Text;

            richTextBox1.Text = "";

            richTextBox1.Text += hashOne + ":";

            textBox1.Text = "";



            textBox1.Text = "Processing of the word list is finished, check the box below for result";



            StreamReader reader = new StreamReader("lol.txt");

            string strAllFile = reader.ReadToEnd().Replace("\r\n", "\n").Replace("\n\r", "\n");

            string[] arrLines = strAllFile.Split(new char[] { '\n' });



            reader.Close();





            



            for (int i = 0; i < 500000; i++)

            {

                source = arrLines[i];

                hash = getMd5Hash(source);



                if (hashOne == hash)

                {

                    richTextBox1.Text = "";

                    richTextBox1.Text = hashOne + " = " + arrLines[i];

                }

                else

                {

                    

                }





            }

            

        }



        private void button3_Click(object sender, EventArgs e)

        {

            hashOne = "";

            harren = "";

            textBox1.Text = "";

            richTextBox1.Text = "";

        }



        private void richTextBox1_TextChanged(object sender, EventArgs e)

        {



        }



        

    }

}