Aqui les dejo un pequeño generador en MASM32, para los que quieran iniciarse en la programación de este lenguaje:
rsrc.rc
#include "\masm32\include\resource.h"
#define IDC_STATIC -1
#define IDI_ICON 101
#define IDC_CMDGENERAR 3000
#define IDC_CMDINFO 3001
#define IDC_CHKNUMEROS 3002
#define IDC_CHKMAYUSCULAS 3003
#define IDC_CHKMINUSCULAS 3004
#define IDC_CHKSIMBOLOS 3005
#define IDC_COMBOFORMATO 3006
#define IDC_TXTPASS 3007
IDI_ICON ICON DISCARDABLE "misfits.ico"
IDD_DIALOG DIALOGEX 0, 0, 157, 105
STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_FIXEDSYS | WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU
CAPTION "Password Generator by PeterPunk"
FONT 8, "Ms Shell Dlg 2"
BEGIN
DEFPUSHBUTTON "Generar", IDC_CMDGENERAR, 15, 85, 50, 14, BS_DEFPUSHBUTTON, 0, 0
PUSHBUTTON "Info", IDC_CMDINFO, 90, 85, 50, 14, BS_PUSHBUTTON, 0, 0
GROUPBOX "Alfabeto", IDC_STATIC, 5, 5, 145, 24, 0, 0, 0
GROUPBOX "Formato", IDC_STATIC, 5, 31, 145, 24, 0, 0, 0
GROUPBOX "Password", IDC_STATIC, 5, 57, 145, 24, 0, 0, 0
AUTOCHECKBOX "0-9", IDC_CHKNUMEROS, 15, 15, 25, 10, BS_AUTOCHECKBOX, 0, 0
AUTOCHECKBOX "A-Z", IDC_CHKMAYUSCULAS, 45, 15, 25, 10, BS_AUTOCHECKBOX, 0, 0
AUTOCHECKBOX "a-z", IDC_CHKMINUSCULAS, 75, 15, 25, 10, BS_AUTOCHECKBOX, 0, 0
AUTOCHECKBOX "Símbolos", IDC_CHKSIMBOLOS, 105, 15, 40, 10, BS_AUTOCHECKBOX, 0, 0
COMBOBOX IDC_COMBOFORMATO, 15, 39, 125, 100, CBS_DROPDOWN, 0, 0
EDITTEXT IDC_TXTPASS, 15, 66, 125, 12, ES_CENTER | ES_AUTOHSCROLL | ES_READONLY, 0
END
PasswordGenerator.asm
.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\masm32.lib
WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
.data
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx resource data xxxx
IDC_STATIC equ -1
IDI_ICON equ 101
IDC_CMDGENERAR equ 3000
IDC_CMDINFO equ 3001
IDC_CHKNUMEROS equ 3002
IDC_CHKMAYUSCULAS equ 3003
IDC_CHKMINUSCULAS equ 3004
IDC_CHKSIMBOLOS equ 3005
IDC_COMBOFORMATO equ 3006
IDC_TXTPASS equ 3007
dlgname db "IDD_DIALOG",0
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx enter your text xxxx
szTitulo db "Password Generator by PeterPunk",0
szAboutText db "Password Generator coded by PeterPunk",13,10
db "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",13,10,13,10
db "Formato:",13,10
db 34,"0",34,": Número en esa posición",13,10
db 34,"A",34,": Letra mayúscula en esa posición",13,10
db 34,"a",34,": Letra minúscula en esa posición",13,10
db 34,"?",34,": Cualquier caracter del alfabeto",13,10
db 34,"$",34,": Siguiente caracter literal",13,10
db "Resto de los caracteres: Caracter literal",0
szNumeros db "0123456789",0
szMayusculas db "ABCDEFGHIJKLMNOPQRSTUVWXYZ",0
szMinusculas db "abcdefghijklmnopqrstuvwxyz",0
szSimbolos db " !",34,"#$%&'()*+,-./:;<=>?@[\]^_`{|}~",0
szFormato1 db "????-????-????-????",0
szFormato2 db "????????",0
szFormato3 db "AAAA-00000000-AAAA",0
.data?
hInstance dd ?
hNumeros dd ?
hMayusculas dd ?
hMinusculas dd ?
hSimbolos dd ?
hFormato dd ?
szAlfabeto db 96 dup (?)
szFormato db 101 dup (?)
szPassword db 101 dup (?)
LonAlfabeto dd ?
LonFormato dd ?
.code
start:
invoke GetModuleHandle, NULL
mov hInstance, eax
invoke DialogBoxParam, hInstance, ADDR dlgname, 0, ADDR WndProc, 0
invoke ExitProcess, eax
WndProc proc hWin:DWORD,uMsg:DWORD,wParam:DWORD,lParam :DWORD
.if uMsg == WM_INITDIALOG
invoke LoadIcon, hInstance, IDI_ICON
invoke SendMessage, hWin, WM_SETICON, 0, eax
invoke GetDlgItem, hWin, IDC_CHKNUMEROS
mov hNumeros, eax
invoke GetDlgItem, hWin, IDC_CHKMAYUSCULAS
mov hMayusculas, eax
invoke GetDlgItem, hWin, IDC_CHKMINUSCULAS
mov hMinusculas, eax
invoke GetDlgItem, hWin, IDC_CHKSIMBOLOS
mov hSimbolos, eax
invoke GetDlgItem, hWin, IDC_COMBOFORMATO
mov hFormato, eax
invoke SendMessage, hNumeros, BM_SETCHECK, 1, 0
invoke SendMessage, hMayusculas, BM_SETCHECK, 1, 0
invoke SendMessage, hFormato, CB_ADDSTRING, 0, offset szFormato1
invoke SendMessage, hFormato, CB_ADDSTRING, 0, offset szFormato2
invoke SendMessage, hFormato, CB_ADDSTRING, 0, offset szFormato3
invoke SendMessage, hFormato, CB_SETCURSEL, 0, 0
invoke GetTickCount
invoke nseed, eax
.elseif uMsg == WM_CLOSE
invoke EndDialog, hWin, 0
.elseif uMsg == WM_COMMAND
.if wParam == IDC_CMDINFO
invoke MessageBox, hWin, offset szAboutText, offset szTitulo, MB_OK
.elseif wParam == IDC_CMDGENERAR
mov byte ptr [szAlfabeto], 0
mov LonAlfabeto, 0
invoke SendMessage, hNumeros, BM_GETCHECK, 0, 0
.if (eax)
invoke lstrcat, offset szAlfabeto, offset szNumeros
add LonAlfabeto, 10
.endif
invoke SendMessage, hMayusculas, BM_GETCHECK, 0, 0
.if (eax)
invoke lstrcat, offset szAlfabeto, offset szMayusculas
add LonAlfabeto, 26
.endif
invoke SendMessage, hMinusculas, BM_GETCHECK, 0, 0
.if (eax)
invoke lstrcat, offset szAlfabeto, offset szMinusculas
add LonAlfabeto, 26
.endif
invoke SendMessage, hSimbolos, BM_GETCHECK, 0, 0
.if (eax)
invoke lstrcat, offset szAlfabeto, offset szSimbolos
add LonAlfabeto, 33
.endif
invoke GetDlgItemText, hWin, IDC_COMBOFORMATO, offset szFormato,100
mov LonFormato, eax
xor ecx, ecx
mov esi, offset szFormato
mov edi, offset szPassword
@bucle:
push ecx
movzx eax, byte ptr [esi]
.if eax == '0'
invoke nrandom, 10
lea eax, [szNumeros+eax]
movzx eax, byte ptr [eax]
.elseif eax == 'A'
invoke nrandom, 26
lea eax, [szMayusculas+eax]
movzx eax, byte ptr [eax]
.elseif eax == 'a'
invoke nrandom, 26
lea eax, [szMinusculas+eax]
movzx eax, byte ptr [eax]
.elseif eax == '?'
cmp LonAlfabeto, 0
jz @NonAlfabeto
invoke nrandom, LonAlfabeto
lea eax, [szAlfabeto+eax]
movzx eax, byte ptr [eax]
@NonAlfabeto:
.elseif eax == '$'
inc esi
movzx eax, byte ptr [esi]
.endif
mov byte ptr [edi], al
inc esi
inc edi
pop ecx
inc ecx
cmp ecx, LonFormato
jb @bucle
mov byte ptr [edi], 0
invoke SetDlgItemText, hWin, IDC_TXTPASS, offset szPassword
.endif
.endif
xor eax, eax
ret
WndProc endp
end start
bytes ;)