Everyone else seems to be posting password-making pieces, so here is one I made years ago (back when I went by Lime). Yes, I'm sure there's plenty more optimization to be done yet, though I have done a complete recode of the core alias (since it was extremely redundant). Some may remember seeing v2.0 of this script, the recode has bumped it up.
This alias does not offer passwords to others as others do via /notice and all that, but provides the user with a small dialog where they can customize aspects of their password, and have one generated, with no character limit so long as their computer can withstand the load from mIRC.
When loading via on LOAD, it will automatically open for you, otherwise just right-click somewhere and select PassGen, or type /passgen.
Update with 4.0: Made the code a bit smaller and removed some redundancy. My tests about a 25% decrease in processing time :] (15000 characters, Numbers, Mixed Case Letters, Symbols, No Repeated Characters Active).
;PassGen 4.0
;By IllogicTC
;Use /passgen to open dialog
alias genpass {
did -r passgen 2
var %types
if ($did(passgen,3).state = 1) var %types %types n
if ($did(passgen,4).state = 1) {
if ($did(passgen,5).sel = 1) var %types %types u
elseif ($did(passgen,5).sel = 2) var %types %types l
else var %types %types u l
}
if ($did(passgen,10).state = 1) var %types %types s
var %rpt $did(passgen,6).state , %a 0 , %b $did(passgen,1)
var %last
while (%a < %b) {
inc %a
:start
var %c $gettok(%types,$rand(1,$numtok(%types,32)),32)
if (%c = n) {
var %w $rand(0,9)
if (%w = %last) && (%rpt = 1) goto start
did -a passgen 2 %w
%last = %w
}
if (%c = u) {
var %w $rand(A,Z)
if (%w = %last) && (%rpt = 1) goto start
did -a passgen 2 %w
%last = %w
}
if (%c = l) {
var %w $rand(a,z)
if (%w = %last) && (%rpt = 1) goto start
did -a passgen 2 %w
%last = %w
}
if (%c = s) {
var %i $rand(1,2)
if (%i == 1) var %y $chr(45)
else var %y $chr(95)
if (%y = %last) && (%rpt = 1) goto start
did -a passgen 2 %y
%last = %y
}
}
}
alias passgen {
dialog -m passgen passgen
}
menu status,channel {
PassGen:/passgen
}
dialog passgen {
title "PassGen v.4.0"
size -1 -1 79 127
option dbu
edit "", 1, 30 7 43 10
edit "", 2, 5 98 69 10, autohs
check "Numbers", 3, 31 19 32 10
check "Letters", 4, 31 29 36 10
button "Start!", 8, 20 74 36 12, disable
button "Copy", 9, 3 113 32 12
button "Done", 12, 43 113 32 12, ok
box "Setup", 13, 2 0 75 90
text "Include:", 15, 8 19 21 8, right
text "Size Limit:", 16, 4 8 25 8, right
check "Symbols", 10, 31 51 31 10
box "Password:", 11, 2 90 75 21
combo 5, 31 39 42 36, size drop
check "No repeated characters", 6, 6 62 69 10
}
on *:dialog:passgen:init:*: {
did -a $dname 5 Up. Case
did -a $dname 5 Lw. Case
did -a $dname 5 Mixed
did -c $dname 3,4,6,5 3
}
on *:dialog:passgen:*:*: {
if ($devent = edit) && ($did = 1) {
if ($did($dname,1) !isnum) did -ra $dname 1 $left($did($dname,1),$calc($len($did($dname,1)) - 1))
if ($len($did($dname,1)) > 0) {
if ($did($dname,3).state = 1) || ($did($dname,4).state = 1) || ($did($dname,10).state = 1) did -e $dname 8
}
if ($len($did($dname,1)) = 0) did -b $dname 8
}
if ($devent = sclick) {
if ($did = 3) {
if ($did($dname,3).state = 0) {
if ($did($dname,4).state == 0) && ($did($dname,10).state = 0) did -b $dname 8
}
if ($did($dname,3).state = 1) {
if ($len($did($dname,1).text) > 0) did -e $dname 8
}
}
if ($did = 4) {
if ($did($dname,4).state = 0) {
did -bu $dname 5,
if ($did($dname,10).state = 0) && ($did($dname,3).state = 0) did -b $dname 8
}
if ($did(passgen,4).state = 1) {
did -e $dname 5
did -c $dname 5 3
if ($len($did($dname,1).text) > 0) did -e $dname 8
}
}
if ($did = 8) genpass
if ($did = 9) clipboard $did($dname,2)
if ($did = 10) {
if ($did($dname,10).state = 0) {
if ($did($dname,3).state = 0) && ($did($dname,4).state = 0) did -b $dname 8
}
if ($did($dname,10).state = 1) {
if ($len($did($dname,1).text) > 0) did -e $dname 8
}
}
}
}
on *:load: {
echo -a PassGen has been loaded. To start using PassGen, type /passgen or select the Passgen option in a popup menu.
passgen
}
Well, I agree but I've often shocked myself that there are old timers who happen to use the outdated versions and complain a code ain't workin (not even bother to notice the error and all that)...only turns out that their mIRC doesn't support $v1. Sure it's their own darn fault, and they like to stick to their "mIRC classic." :P
LMAO
You don't have to use $v1 but $1. Using $1 also gives those old mirc users a safe bet for this code to work for them 100%.
Your absolutely right that I could have just used $1, I only used $v1 out of habbit but the fact is that the $v1 and $v2 variables were introduced in 07/07/2004 in mIRC v6.16.
I seriously doubt we should take the time to concern ourselves with people still running something that old. Any effort to that end should be put towards getting those people to finally upgrade their mircs.
Nice.
I made a little alteration to mine..(the one I pasted it before in the other password snippet that the OP was referring to).....I thought "why not add symbols/punctuation too" and so with that in mind was actually able to shorten it by using $chr and the numbers that all letters, numbers and usable characters fall into. Like before it defaults to a random size of 12 to 18 characters unless you specify the length like $makepass(129) .
alias makepass {
var %go $iif($1 isnum,$v1,$r(12,18))
while (%go) {
var %pass %pass $+ $chr($r(33,126))
dec %go
}
return %pass
}
I like the little dialog yours came with but not sure I wanna invest that kinda time into what is really a silly snippet.