CheckPass.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7. namespace DLLCheck
  8. {
  9. public class CheckPass
  10. {
  11. public bool ClassCheckPass(string pass)
  12. {
  13. if(pass.Length < 6)
  14. return false;
  15. int countUp = 0, countLow = 0;
  16. for (int i = 0; i < pass.Length; i++)
  17. {
  18. if (char.IsLower(pass[i]))
  19. countLow++;
  20. if (char.IsUpper(pass[i]))
  21. countUp++;
  22. }
  23. if(countUp == 0 || countLow == 0)
  24. return false;
  25. int countNum = 0;
  26. for (int i = 0; i < pass.Length; i++)
  27. if (char.IsDigit(pass[i]))
  28. countNum++;
  29. if(countNum > pass.Length / 2)
  30. return false;
  31. int countSim = 0;
  32. for (int i = 0; i < pass.Length; i++)
  33. if ("!@#$%^".Contains(pass[i]))
  34. countSim++;
  35. if(countSim == 0)
  36. return false;
  37. return true;
  38. }
  39. }
  40. }