Advertisement
Guest User

Untitled

a guest
Nov 28th, 2015
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. #include <stdio.h>
  2. #define passlength 13
  3. int main ()
  4. {
  5. int length=-1, bigletters=0, smallletters=0, numbers=0, symbols=0, i, j, check=0, counter=0, flag=0, combination=0;
  6. char password[passlength];
  7. printf ("Please enter password: ");
  8. for (i=0;flag==0;i++){
  9. length++;
  10. password[i]=getchar();
  11. printf ("%c", password[i]);
  12. if (password[i]=='\n'){
  13. flag=1;
  14. }
  15. else if ((password[i]>='A')&&(password[i]<='Z')){
  16. bigletters++;
  17. }
  18. else if (password[i]>='a'&&password[i]<='z'){
  19. smallletters++;
  20. }
  21. else if (password[i]>='0'&&password[i]<='9'){
  22. numbers++;
  23. }
  24. else if ((password[i]>=0&&password[i]<=47)||(password[i]>=58&&password[i]<=64)||(password[i]>=90&&password[i]<=96)||(password[i]>123)){
  25. symbols++;
  26. }
  27. else if (numbers==0){
  28.  
  29. }
  30. else if (bigletters==0 && smallletters==0){
  31.  
  32. }
  33.  
  34. if ((i!=0)&&(((password[i])==(password[i-1]+1))||((password[i])==(password[i-1]-1)))) {
  35. combination++;
  36. }
  37.  
  38.  
  39.  
  40.  
  41.  
  42. }
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63. if (length<8||length>13){
  64. printf ("Invalid password length");
  65. return 0;
  66. }
  67. else {
  68. printf ("password strength index: %d", smallletters);
  69. return 0;
  70. }
  71.  
  72.  
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement