Advertisement
Guest User

Untitled

a guest
Aug 9th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. using System.Collections.Generic;
  2.  
  3. internal struct Account
  4. {
  5. private const string key = "ZhugeLiang10041812308234ZhugeLiang10041812308234ZhugeLiang10041812308234ZhugeLiang10041812308234";
  6.  
  7. public string username;
  8.  
  9. public string password;
  10.  
  11. private HashSet<int> st;
  12.  
  13. public string passwordDecrypted
  14. {
  15. get
  16. {
  17. try
  18. {
  19. return tryToDecrypt(password);
  20. }
  21. catch
  22. {
  23. return "123456";
  24. }
  25. }
  26. }
  27.  
  28. public Account(string s)
  29. {
  30. string[] array = s.Split(';');
  31. username = array[0];
  32. password = array[1];
  33. st = new HashSet<int>();
  34. createSet();
  35. }
  36.  
  37. private void createSet()
  38. {
  39. List<int> list = new List<int>();
  40. list.Add(1);
  41. list.Add(1);
  42. st.Add(1);
  43. for (int i = 2; i < "ZhugeLiang10041812308234ZhugeLiang10041812308234ZhugeLiang10041812308234ZhugeLiang10041812308234".Length; i++)
  44. {
  45. list.Add(list[i - 1] + list[i - 2]);
  46. st.Add(list[i]);
  47. }
  48. }
  49.  
  50. private string tryToDecrypt(string s)
  51. {
  52. string text = s;
  53. string text2 = "ZhugeLiang";
  54. for (int i = 0; i < 6; i++)
  55. {
  56. text = decrypt(text);
  57. string text3 = text.Substring(0, text.Length - text2.Length);
  58. string a = text.Substring(text.Length - text2.Length, text2.Length);
  59. if (a == text2)
  60. {
  61. text = text3;
  62. break;
  63. }
  64. }
  65. return text;
  66. }
  67.  
  68. private string decrypt(string s)
  69. {
  70. char[] array = new char[0];
  71. array = s.ToCharArray();
  72. string text = "";
  73. int num = 0;
  74. while (num < array.Length)
  75. {
  76. if (st.Contains(text.Length))
  77. {
  78. char c = array[num + 1];
  79. c = (char)(c - (ushort)text.Length);
  80. c = (char)(c - "ZhugeLiang10041812308234ZhugeLiang10041812308234ZhugeLiang10041812308234ZhugeLiang10041812308234"[text.Length]);
  81. text += c;
  82. num += 2;
  83. }
  84. else
  85. {
  86. char c2 = array[num];
  87. c2 = (char)(c2 - (ushort)text.Length);
  88. c2 = (char)(c2 - "ZhugeLiang10041812308234ZhugeLiang10041812308234ZhugeLiang10041812308234ZhugeLiang10041812308234"[text.Length]);
  89. text += c2;
  90. num++;
  91. }
  92. }
  93. return text;
  94. }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement