Нема описа

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. RAN 2014-08-20
  3. -- Simplified the upperCheck, lowerCheck, etc.. repeatChars, functions
  4. -- Fixed many of the warnings
  5. -- Eliminated findLetterpos, alpha[]
  6. RAN 2014-08-21
  7. -- Las funciones de contar consecutivos tienen error. Estoy arreglando.
  8. -- Cree una nueva función "generica" para contar consectuivos: countRepeated
  9. IVE 2015-06-14
  10. -- declare variables digit_count y symbol_count que estaban sin declarar
  11. */
  12. /// \file
  13. #include "mainwindow.h"
  14. #include "ui_mainwindow.h"
  15. #include "psfunctions.h"
  16. #include <vector>
  17. #include <QDebug>
  18. #include <string>
  19. using namespace std;
  20. /// \fn void MainWindow::readPass(const string &pass)
  21. /// \~English
  22. /// \brief Main function, where all the other PasswordStrength
  23. /// functions are executed
  24. /// \param pass string by reference to analyze
  25. /// \~Spanish
  26. /// \brief Funcion principal, donde todas las otras funciones de fortaleza
  27. /// de passwords son ejecutadas.
  28. /// \param pass cadena de caracteres por referencia a analizar.
  29. void MainWindow::readPass(const string &pass){
  30. string strength = "Compute Me" ;
  31. int totalScore = 0;
  32. int requirements = 0;
  33. int count ;
  34. int score ;
  35. int len ;
  36. /*
  37. * Password Additions:
  38. */
  39. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  40. // Check the length of the string (min:8, better>8, n*4)
  41. len = count = pass.length() ;
  42. score = 4 * count ;
  43. setNumberOfCharacters(count, score);
  44. totalScore += score ;
  45. // Uppercase letters (good-min:1, better-min:2, (len-n)*2)
  46. count = countUppercase(pass) ;
  47. score=0;
  48. if(count) {
  49. requirements += 1;
  50. score = (len - count) * 2 ;
  51. }
  52. setUpperCharacters(count, score);
  53. totalScore += score ;
  54. // Lowercase letters (good-min:1, better-min:2, (len-n)*2)
  55. // YOUR CODE HERE
  56. // Digits (good-min:1, better-min:2, n*4)
  57. // YOUR CODE HERE
  58. // Symbols (good-min:1, better-min:2, n*6)
  59. // YOUR CODE HERE
  60. // Middle Numbers or Symbols (good-min:1, better-min:2, n*2)
  61. // YOUR CODE HERE
  62. // Add requirements score
  63. // YOUR CODE HERE
  64. // Letters Only [-n]
  65. // YOUR CODE HERE
  66. // Digits Only [-n]
  67. // YOUR CODE HERE
  68. // Consecutive Uppercase Letters [-(n*2)]
  69. // YOUR CODE HERE
  70. // Consecutive Lowercase Letters [-(n*2)]
  71. // YOUR CODE HERE
  72. // Consecutive Digits [-(n*2)]
  73. // YOUR CODE HERE
  74. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  75. // Clasify the strength to control progress bar
  76. // YOUR CODE HERE
  77. strengthDisplay(strength, totalScore);
  78. }