256 Kilobytes

Answers in Client-Side | By August R. Garcia

Published | Last Update

104 views, 0 RAMs, and 0 comments

Tags: HTML, JavaScript, Security, Passwords, Forms

Profile Photo - August R. GarciaAugust R. GarciaLARPing as a Sysadmi...Portland, ORSite Owner

Probably edit slightly for a cleaner UI

Code and demo:

Message Here 
<form>
	<input id="test" type="text" />
	<span id="msg"></span>
</form>

<script>
function has_lower_case(str)      {  return (/[a-z]/.test(str));         }
function has_upper_case(str)      {  return (/[A-Z]/.test(str));         }
function has_numeric(str)         {  return (/[0-9]/.test(str));         }
function has_nonalphanumeric(str) {  return !(/^[a-z0-9]+$/.test(str));  }

// 32 Non-Alphanumeric Characters on a Standard Keyboard
// `~!@#$%^&*()_-+=[]{}\|;',./:"<>?

// https://stackoverflow.com/questions/8211744/convert-time-interval-given-in-seconds-into-more-human-readable-form
function secondsToString(seconds) {
	var numyears = Math.floor(seconds / 31536000);
	var numdays = Math.floor((seconds % 31536000) / 86400); 
	var numhours = Math.floor(((seconds % 31536000) % 86400) / 3600);
	var numminutes = Math.floor((((seconds % 31536000) % 86400) % 3600) / 60);
	var numseconds = (((seconds % 31536000) % 86400) % 3600) % 60;
	return numyears + " years " +  numdays + " days " + numhours + " hours " + numminutes + " minutes " + numseconds + " seconds";
}


document.getElementById("test").addEventListener("change", function() {
    str = this.value;
    
	charset_size = 0; 
	if (  has_lower_case(str)       ) charset_size += 26;  
	if (  has_upper_case(str)       ) charset_size += 26;  
	if (  has_numeric(str)          ) charset_size += 10;  
	if (  has_nonalphanumeric(str)  ) charset_size += 32;  

    num_characters   = str.length; 
    num_combinations = Math.pow(charset_size, num_characters); 

    num_checkable_per_second = 2800000000;
    seconds_to_crack         = num_combinations / num_checkable_per_second; 
    time_to_crack            = secondsToString(seconds_to_crack); 

	document.getElementById("msg").innerHTML = "Estimated time to crack this password: " + time_to_crack; 
}); 

// Graphics processors can speed up password cracking by a factor of 50 to 100 over general purpose computers. As of 2011, available commercial products claim the ability to test up to 2,800,000,000 passwords a second on a standard desktop computer using a high-end graphics processor.[9] Such a device can crack a 10 letter single-case password in one day. The work can be distributed over many computers for an additional speedup proportional to the number of available computers with comparable GPUs.[citation needed]
// https://en.wikipedia.org/wiki/Password_cracking

</script>

Download more RAM. 🐏 ⨉ 0Posted by August R. Garcia 5 months ago

Edit History

• [2019-12-06 15:14 PST] August R. Garcia (5 months ago)
🕓 Posted at 06 December, 2019 15:14 PM PST

Sir, I can do you a nice SEO.

Post a New Comment

Do you like having a good time?

Register an Account

You can also login to an existing account or reset your password. All use of this site is subject to the terms of service and privacy policy.

Read Quality Articles

Read some quality articles. If you can manage to not get banned for like five minutes, you can even post your own articles.

View Articles →

Argue with People on the Internet

Use your account to explain why people are wrong on the Internet forum.

View Forum →

Vandalize the Wiki

Or don't. I'm not your dad.

View Wiki →

Ask and/or Answer Questions

If someone asks a terrible question, post a LMGTFY link.

View Answers →

Make Some Money

Hire freelancers and/or advertise your goods and/or services. Hire people directly. We're not a middleman or your dad. Manage your own business transactions.

Register an Account

Answers— Read More

Find more related content below!