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.
}
}
}
@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.
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))) }