The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
Strong Password V2 - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28)
+--- Forum: Modifications and Hackery (https://userspice.com/forums/forumdisplay.php?fid=29)
+--- Thread: Strong Password V2 (/showthread.php?tid=165)



Strong Password V2 - Ponchale - 06-16-2016

I share the code for calculate the strong of one password

<pre>
Code:
entropia_x_caracter= log2(n)

entropia_password= longitud * entropia_x_caracter
</pre>


<pre>
Code:
function checkPass($pass) {
     $count=strlen($pass);
     $entropia=0;
    // Si el password tiene menos de 6 caracteres
    if ($count < 6) {
         return 'El password es muy corto.';
    }
  
    // Contamos cuantas mayusculas, minusculas, numeros y simbolos existen
    $upper = 0; $lower = 0; $numeros = 0; $otros = 0;
    
    for ($i = 0, $j = strlen($pass); $i < $j; $i++) {
        $c = substr($pass,$i,1);
        if (preg_match('/^[[:upper:]]$/',$c)) {
            $upper++;
        } elseif (preg_match('/^[[:lower:]]$/',$c)) {
            $lower++;
        } elseif (preg_match('/^[[:digit:]]$/',$c)) {
            $numeros++;
        } else {
            $otros++;
        }
    }

   // Calculamos la entropia
  
  $entropia= ($upper*4.7)+ ($lower*4.7)+($numeros*3.32)+($otros*6.55);
  
  if ($entropia<28)
  {
    echo "Password muy debil";    
   }elseif($entropia<36) {
        echo "Password debil";            
   }elseif($entropia<60) {
       echo "Password Razonable";
   }elseif($entropia<128) {
       echo "Password Fuerte";
   }else {
       echo "Password Muy Fuerte";
       }
    
    return false;
    
}
echo checkPass("CAPautomovil-2012");

?>
</pre>




Strong Password V2 - mudmin - 06-16-2016

This has been on my mental to-do list for a while! Thank you. I will check this out!