Grad Assignment 5

Checking password strengthen based on cpu processing power.

by Larry Adams

HTML

<script src="http://jquery-pwdstr.googlecode.com/files/jquery.pwdstr-1.0.source.js"></script>
<h1>Graduate Assisgnment 5</h1>

<p>This assignment is to help you to better understand security and encrptying your passwords against Brute Force Attacks.</p>

<p>Please use the password generator to check your work with
<a href="https://www.masterlockvault.com/how-to-create-a-secure-password?gclid=CjwKEAjwpsGqBRCioKet--bp_QcSJADCtbsbadXoOaKuWhZxoAl0ld9Aw3VWI0TrI_bS3OWW0fq1JBoCaEXw_wcB">Master Lock Company</a></p>

Password: <input id="text" type="password" />
Stregthren is <span id="results"></span>

<p>Your Task is to make a password stregthren greater than 20 years.</p>
<p>Explain what bench mark is the standard for a strong password and good security practice.</p>

CSS

h1 { 
    display: block;
    font-size: 2em;
    margin-top: 0.67em;
    margin-bottom: 0.67em;
    margin-left: 0;
    margin-right: 0;
    font-weight: bold;
}

p {
    display: block;
    margin-top: 1em;
    margin-bottom: 1em;
    margin-left: 0;
    margin-right: 0;
}

JavaScript

// Your task in to write the jQuery code for testing the stregthen (year, month, day, seconds).


$('#text').pwdstr('#results');

// Your code goes here ----->

/*

(function($){ 
     $.fn.extend({  
         pwdstr: function(el) {			
			return this.each(function() {
						
					$(this).keyup(function(){
						$(el).html(getTime($(this).val()));
					});
					
					
                // based on the cpu processing power 280 million per second
                function getTime(str){
					
					var chars = 0;
					var rate = 2800000000;
					
					if((/[a-z]/).test(str)) chars +=  26;
					if((/[A-Z]/).test(str)) chars +=  26;
					if((/[0-9]/).test(str)) chars +=  10;
					if((/[^a-zA-Z0-9]/).test(str)) chars +=  32;

					
                    // Declaring the variables for                     
                    var pos = Math.pow(chars,str.length);
					var s = pos/rate;
					
					var decimalYears = s/(3600*24*365);
					var years = Math.floor(decimalYears);
					
					var decimalMonths =(decimalYears-years)*12;
					var months = Math.floor(decimalMonths);
					
					var decimalDays = (decimalMonths-months)*30;
					var days = Math.floor(decimalDays);
					
					var decimalHours = (decimalDays-days)*24;
					var hours = Math.floor(decimalHours);
					
					var decimalMinutes = (decimalHours-hours)*60;
					var minutes = Math.floor(decimalMinutes);
					
					var decimalSeconds = (decimalMinutes-minutes)*60;
					var seconds = Math.floor(decimalSeconds);
					
					var time = [];
					
					if(years > 0){
						if(years == 1)
							time.push("1 year, ");
						else
							time.push(years + " years, ");
					}
					if(months > 0){
						if(months == 1)
							time.push("1 month, ");
						else
							time.push(months + " months, ");
					}
					if(days > 0){
						if(days == 1)
							time.push("1 day, ");
				 		else
							time.push(days + " days, ");
					}
					if(hours > 0){
						if(hours == 1)
							time.push("1 hour, ");
						else
							time.push(hours...