Advertisement
Guest User

Untitled

a guest
Jan 11th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Windows.Forms;
  5. using System.IO;
  6. using System.Security.Cryptography;
  7.  
  8. namespace find_hash
  9. {
  10. public partial class Form1 : Form
  11. {
  12. public Form1()
  13. {
  14. InitializeComponent();
  15. }
  16. private string MD5Digest(string data)
  17. {
  18. MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
  19. byte[] result = md5.ComputeHash(Encoding.Default.GetBytes(data));
  20. StringBuilder sb = new StringBuilder();
  21. for (int i = 0; i < result.Length; i++)
  22. sb.Append(result[i].ToString("x2"));
  23. return sb.ToString();
  24. }
  25. static string MD5(string s)
  26. {
  27. MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
  28. Byte[] bytes4MD5 = Encoding.UTF8.GetBytes(s);
  29. byte[] checkSum = md5.ComputeHash(bytes4MD5);
  30. return BitConverter.ToString(checkSum).Replace("-", String.Empty);
  31. }
  32. private void button1_Click(object sender, EventArgs e)
  33. {
  34. StreamReader stroka = new StreamReader(@"C:UsersAlanDesktopmdfive.txt");
  35. textBox1.Text = stroka.ReadLine();
  36. string text = File.ReadAllText(@"C:UsersAlanDesktopstrings.txt");
  37. string shifr = MD5(text).ToLower();
  38. if (textBox1.Text==shifr)
  39. {
  40. textBox2.Text = text.ToString();
  41. }
  42. text = text.Replace("words111", "words112");
  43. File.WriteAllText(@"C:UsersAlanDesktopstrings.txt", text);
  44. if (textBox1.Text == shifr)
  45. {
  46. textBox2.Text = text.ToString();
  47. }
  48. text = text.Replace("words112", "words113");
  49. File.WriteAllText(@"C:UsersAlanDesktopstrings.txt", text);
  50. if (textBox1.Text == shifr)
  51. {
  52. textBox2.Text = text.ToString();
  53. }
  54. text = text.Replace("words113", "words114");
  55. File.WriteAllText(@"C:UsersAlanDesktopstrings.txt", text);
  56. if (textBox1.Text == shifr)
  57. {
  58. textBox2.Text = text.ToString();
  59. }
  60. text = text.Replace("words114", "words115");
  61. File.WriteAllText(@"C:UsersAlanDesktopstrings.txt", text);
  62. if (textBox1.Text==shifr)
  63. {
  64. textBox2.Text = text.ToString();
  65. }
  66. List<string> list = new List<string>();
  67. list.AddRange(File.ReadAllLines(@"C:UsersAlanDesktopstrings.txt"));
  68.  
  69. string s = string.Empty;
  70. string a = string.Empty;
  71.  
  72. textBox1.Text = textBox1.Text.ToLower();
  73. for (int i = 0; i < list.Count; i++)
  74. {
  75. s = list[i];
  76. a = MD5Digest(s);
  77.  
  78. if (a == textBox1.Text)
  79. {
  80. textBox2.Text = s;
  81. break;
  82. }
  83. }
  84. }
  85. }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement