Password strength meter

Posted by Unknown On Tuesday 5 February 2013 1 comments

Password strength meter 

 Here we indrodusing a simple password strength meter,it measure of the effectiveness of a password in resisting guessing and brute-force attacks. In its usual form, it estimates how many trials an attacker who does not have direct access to the password would need, on average, to guess it correctly. The strength of a password is a function of length, complexity, and unpredictability


    




  Download Script                  Live Demo

HTML Code



<form name=df style='margin:0px;'>
<p class="border">
Enter Password .
<input type=password length=20 name='pwd' style="text-decoration:none;color: #dddd;"onkeyup='CheckPasswordStrength(this.value);'>
</p><div id='pwd_strength'></div>
</br>
</form>


JavaScript Code



<script type="text/javascript">

var pass_strength;

function IsEnoughLength(str,length)
{
 if ((str == null) || isNaN(length))
  return false;
 else if (str.length < length)
  return false;
 return true;
 
}

function HasMixedCase(passwd)
{
 if(passwd.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/))
  return true;
 else
  return false;
}

function HasNumeral(passwd)
{
 if(passwd.match(/[0-9]/))
  return true;
 else
  return false;
}

function HasSpecialChars(passwd)
{
 if(passwd.match(/.[!,@,#,$,%,^,&,*,?,_,~]/))
  return true;
 else
  return false;
}


function CheckPasswordStrength(pwd)
{
 if (IsEnoughLength(pwd,14) && HasMixedCase(pwd) && HasNumeral(pwd) && HasSpecialChars(pwd))
  pass_strength = "<b><font style='color:olive'>Very strong</font></b>";
 else if (IsEnoughLength(pwd,8) && HasMixedCase(pwd) && (HasNumeral(pwd) || HasSpecialChars(pwd)))
  pass_strength = "<b><font style='color:Blue'>Strong</font></b>";
 else if (IsEnoughLength(pwd,8) && HasNumeral(pwd))
  pass_strength = "<b><font style='color:Green'>Good</font></b>";
 else
  pass_strength = "<b><font style='color:red'>Weak</font></b>";

 document.getElementById('pwd_strength').innerHTML = pass_strength;
}
function ctck()
{
     var sds = document.getElementById("dum");
     if(sds == null){
        alert("You are using a free package.\n You are not allowed to remove the tag.\n");
     }
     var sdss = document.getElementById("dumdiv");
     if(sdss == null){
         alert("You are using a free package.\n You are not allowed to remove the tag.\n");
     }
}
document.onload ="ctck()";
</script>



Don't Forget To Comment ...!
scriptime.blogspot.in

1 comments:

Marilyn Hanson said...

Loved reading thhis thank you

Post a Comment

Fashion