Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. Stack<char> password = new Stack<char>();
  2. Random dig = new Random();
  3. string alphabat = "abcdefghijklmnopqrstuvwxyz";
  4. int counter = 0, temp = 0;
  5. char ch;
  6. long num = 248410397744610;
  7. while (num != 0)
  8. {
  9. counter++;
  10. temp = dig.Next(0, 26);
  11. if ((num - temp) % 17 != 0)
  12. {
  13. while ((num - temp) % 17 != 0)
  14. {
  15. temp = dig.Next(0, 26);
  16. }
  17. }
  18. ch = alphabat[temp-1];
  19. password.Push(ch);
  20. num -= temp;
  21. num /= 17;
  22. if (num < 0)
  23. {
  24. num = 248410397744610;
  25. password.Clear();
  26. counter = 0;
  27. }
  28. }
  29. Console.WriteLine("The length is: " + counter);
  30. Console.Write("The password is: ");
  31. ch = password.Pop();
  32. Console.Write(ch);
  33. for (int i = 0; i < counter - 1; i++)
  34. {
  35. ch = password.Pop();
  36. Console.Write(ch);
  37. }
  38. Console.WriteLine("");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement