Password Generator

By Alpha Atom on Jan 03, 2011

Generates a hexatridecimal password for you. If you don't specify a length, it defaults to 20 characters, but you can choose anything up to 100. Obviously it's not hugely secure, because it's possible using a debug output to view the password being sent, but I've attempted to make it as secure as possible by using .notice as opposed to /notice or even /msg.

Oh and also, you need to add this to your variables:

%passgen A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9

Example:

[19:33:19] <~Matt> !passgen
[19:33:19] <~JellyFish> Generating a 20 digit hexatridecimal password for Matt...
[19:33:20] -JellyFish- Password Generated: IVG70R4QNUB27RECKHIV

Or, if you choose the length:

[19:41:34] <~Matt> !passgen 40
[19:41:34] <~JellyFish> Generating a 40 digit hexatridecimal password for Matt...
[19:41:34] -JellyFish- Password Generated: SMZF3YFI3J7TF115S1U7XJ0HWFL4LH2MY4JBH2D3

on *:TEXT:!passgen*:#:{
  if (!$2) {
    var %inc = 0
    var %pass = $gettok(%passgen,$rand(1,$numtok(%passgen,32)),32)
    msg # Generating a 20 digit hexatridecimal password for $nick $+ ...
    while (%inc <= 19) {
      var %pass = $instok(%pass,$gettok(%passgen,$rand(1,$numtok(%passgen,32)),32),$len(%pass),15)
      inc %inc 1
      if (%inc == 19) {
        .notice $nick Password Generated: %pass
      }
    }
  }
  if ($2) && ($2 isnum) {
    if ($2 <= 100) {
      var %inc = 0
      var %pass = $gettok(%passgen,$rand(1,$numtok(%passgen,32)),32)
      msg # Generating a $2 digit hexatridecimal password for $nick $+ ...
      while (%inc <= $calc($2 - 1)) {
        var %pass = $instok(%pass,$gettok(%passgen,$rand(1,$numtok(%passgen,32)),32),$len(%pass),15)
        inc %inc 1
        if (%inc == $calc($2 - 1)) {
          .notice $nick Password Generated: %pass
        }
      }
    }
    else {
      msg # A $2 character long password would crash $me $+ . Generate something under 100 characters.
    }
  }
}

Comments

Sign in to comment.
sunslayer   -  Jan 04, 2011

@Jethro_ in the original code the optional $2 is the length

 Respond  
Alpha Atom   -  Jan 04, 2011

Oh my bad, didn't realise that, fair enough xD

 Respond  
jaytea   -  Jan 04, 2011

@jaytea Well, of course I wasn't, but why copy other's scripts all the time, and nobody else on the Cael network(that I'm aware of) uses a password generator. Sorry for sharing.

sorry, should've quoted - i was responding to macs-rock's asinine comment. don't be discouraged!

 Respond  
Alpha Atom   -  Jan 04, 2011

@Sunslayer Thanks for that way, I'm not familiar with all the regex stuff, so I'll stick with what I know.

@macs-rock Nope, I didn't, I've had a look at the way you did it, but you've done it in pretty much the most inefficient way possible.

@jaytea Well, of course I wasn't, but why copy other's scripts all the time, and nobody else on the Cael network(that I'm aware of) uses a password generator. Sorry for sharing.

 Respond  
Jethro   -  Jan 04, 2011

I can't grasp why > $str(.,$iif($1,$1,20))is used when

$str(.,20)

will get the job done just fine.

 Respond  
jaytea   -  Jan 04, 2011

sure, you were the first person to ever think of creating a password generator.

 Respond  
macs-rock   -  Jan 04, 2011

lol looks like he got the idear from mine

 Respond  
Jethro   -  Jan 04, 2011

Oh, Someone is being paranoid toward regsubex...so what is next, binary files? :P I've had a feeling that sunslayer is here to show you the regsubex way...:-)

 Respond  
sunslayer   -  Jan 03, 2011

i hope that no one come here using the same $regsubex way to do a password...
cause everytime someone post a pass generator, someone post it posting different ways to make a snippet is not only encouraged but also the purpose of this site.

so here it is...

mkpass { return $regsubex($str(.,$iif($1,$1,20)),/./g,$iif($r(0,1),$r(a,z),$r(0,9))) }
 Respond  
}{exer   -  Jan 03, 2011

Nice Tool
Works good ty

 Respond  
_Teen_   -  Jan 03, 2011

i hope that no one come here using the same $regsubex way to do a password...
cause everytime someone post a pass generator, someone post it

 Respond  
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.