GeibvbCZ
2017-01-11 19:38:05

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Security.Cryptography;

namespace find_hash
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private string MD5Digest(string data)
{
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
byte[] result = md5.ComputeHash(Encoding.Default.GetBytes(data));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < result.Length; i++)
sb.Append(result[i].ToString("x2"));
return sb.ToString();
}
static string MD5(string s)
{
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
Byte[] bytes4MD5 = Encoding.UTF8.GetBytes(s);
byte[] checkSum = md5.ComputeHash(bytes4MD5);
return BitConverter.ToString(checkSum).Replace("-", String.Empty);
}
private void button1_Click(object sender, EventArgs e)
{
StreamReader stroka = new StreamReader(@"C:UsersAlanDesktopmdfive.txt");
textBox1.Text = stroka.ReadLine();
string text = File.ReadAllText(@"C:UsersAlanDesktopstrings.txt");
string shifr = MD5(text).ToLower();
if (textBox1.Text==shifr)
{
textBox2.Text = text.ToString();
}
text = text.Replace("words111", "words112");
File.WriteAllText(@"C:UsersAlanDesktopstrings.txt", text);
if (textBox1.Text == shifr)
{
textBox2.Text = text.ToString();
}
text = text.Replace("words112", "words113");
File.WriteAllText(@"C:UsersAlanDesktopstrings.txt", text);
if (textBox1.Text == shifr)
{
textBox2.Text = text.ToString();
}
text = text.Replace("words113", "words114");
File.WriteAllText(@"C:UsersAlanDesktopstrings.txt", text);
if (textBox1.Text == shifr)
{
textBox2.Text = text.ToString();
}
text = text.Replace("words114", "words115");
File.WriteAllText(@"C:UsersAlanDesktopstrings.txt", text);
if (textBox1.Text==shifr)
{
textBox2.Text = text.ToString();
}
List<string> list = new List<string>();
list.AddRange(File.ReadAllLines(@"C:UsersAlanDesktopstrings.txt"));

string s = string.Empty;
string a = string.Empty;

textBox1.Text = textBox1.Text.ToLower();
for (int i = 0; i < list.Count; i++)
{
s = list[i];
a = MD5Digest(s);

if (a == textBox1.Text)
{
textBox2.Text = s;
break;
}
}
}
}
}