Random Password Generator

By Savage_CL on Jun 16, 2011

Generates a random password with options like the amount of characters and inclusion of lowercase, uppercase, and numeric characters.

syntax: /newpass <y/n for lowercase> <y/n for uppercase> <y/n for numbers>

stop by #Savage_CL on SwiftIRC and let me know what you think :)

;Random password generator
;By Savage_CL
;support found on swiftIRC in #Savage_CL
;connect command: /server -m irc.swiftirc.net -j #savage_CL

alias newpass {
  if ($1 !isnum) || ($4 == $null) { echo -a you must specify a number of characters and character params. | echo -a Syntax: /newpass <characters> [y/n for lowercase letters] [y/n for Uppercase letters] [y/n for numbers] | return }
  if ($left($$2,1) != y) && ($left($$3,1) != y) && ($left($$4,1) != y) { echo -a You can't have a $$1 character password without any available characters! | return }
  var %temp 1
  while (%temp <= $$1) {
    var %thing $rand(1,3)
    if (%thing == 1) && ($left($$2,1) != n) { var %pass %pass $+ $rand(a,z) | inc %temp }
    elseif (%thing == 2) && ($left($$3,1) != n) { var %pass %pass $+ $rand(A,Z) | inc %temp }
    elseif (%thing == 3) && ($left($$4,1) != n) { var %pass %pass $+ $rand(0,9) | inc %temp }
  echo -a Your $$1 character password is: %pass


Sign in to comment.
Savage_CL   -  Jun 17, 2011

thank you. I would add a limit, Jethro_, but most people are going to actually follow the rules given. This isn't something the avarage user is going to need, so I figured the ones that are going to use it are going to be smart enough to not do something like that. :P

Thanks guys for the accolades, by the way.

Oh. just thought of a fix for you, jethro_. instead of == y for the condition, i'll replace it with != n

napa182   -  Jun 16, 2011

Anyways Savage_CL, I forgot to mention nice job on your snippet. It shows that you are thinking of different ways to go about it.

Meta   -  Jun 16, 2011

Jethro_, pretty sure that's caused by the fact that %temp only increases in the while loop if one of the conditionals is met.

napa182   -  Jun 16, 2011

Jethro_ you an your fiddling... tisk tisk lol jk

Jethro   -  Jun 16, 2011

I was fiddling around with the code and entered this:> /newpass 5 abakjsdfh akjsdfh jkasdfhand I got an endless loop 'til I broke it up. lol

Well, don't get me wrong. You could redo any script that's been done before over and over with your "colorful imagination," it'd still be great to think up something new, not generic...so that your code won't appear dull and ordinary.

napa182   -  Jun 16, 2011

So true Jethro_ it has been done many times before. It was not too long ago that a few different people posted random pass gens one after the other.
Most msl snippets have been done many times over an that is a good thing. You have to love the different takes people have on the same idea.
hmm I wonder who scored this a 10 =/ not that i am saying it is a bad snippet, but someone is way too giving to score this a 10. Maybe a 5 or a 6

blackvenomm666   -  Jun 16, 2011

i still likes it:D works well and fast. im sure just about every script has been done before. just because we havent seen em doesnt mean they havent been done

Jethro   -  Jun 16, 2011

I thought this kind of script had been done before, and you could do this with regsubex in one line...

blackvenomm666   -  Jun 16, 2011

This works very good. And not that anyone would do this most likey but it will do a random pass all the way up to 4100 characters 10 +like

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.