This program generate password about size

Delphi & Pascal (česká wiki)
Přejít na: navigace, hledání
Category: KMP (Club of young programmers)

Author: Furby
Program: Generato.pas
File exe: Generato.exe

This program generate password about size. Password maybe number, text, or number and text together.
{ GENERATO.PAS                                                      }
{                                                                   }
{ Author: FURBY                                                     }
{ Date  : 20.05.2006                           http://www.trsek.com }
 
program generator;
uses crt;
var c,p,dch,pp,cp:real;
    chcem:real;
    heslo:text;
 
begin
  assign(heslo,'HESLO.txt');
  ReWrite(heslo);
  writeln(heslo,'Vygenerovane heslo je: ');
 
  ClrScr;
  gotoxy(20,12);
  writeln('Program na generovanie hesiel...PRESS ANY KEY');
  gotoxy(1,25);
  textcolor(12);
  write('Software by FURBY');
  textcolor(15);
  readkey;
 
  repeat
 
    ClrScr;
    writeln('1-generovat iba cisla 2-generovat cisla aj pismena 3-generovat iba pismena');
    gotoxy(25,12);
    write('Stlac cislo moznosti a ENTER: ');
    readln(chcem);
    pp:=0;
 
    if chcem>3 then begin
       gotoxy(32,13);
       writeln('NESPRAVNY PRIKAZ!');
       readkey;
    end;
 
    if chcem<1 then begin
       gotoxy(32,13);
       writeln('NESPRAVNY PRIKAZ!');
       readkey;
    end;
 
  until (chcem>0) and (chcem<4);
 
  if chcem=1 then begin
     repeat
       Clrscr;
       writeln('Tvoj vyber: iba cisla...');
       write('Zadaj dlzku hesla (max.1000): ');
       readln(dch);
     until (dch>0) and (dch<1001);
 
     repeat
       randomize;
       c:=random(10);
       write(c:1:0);
       write(heslo,c:1:0);
       delay(70);
       pp:=pp+1;
     until pp=dch;
  end;
 
  if chcem=2 then begin
     repeat
       ClrScr;
       writeln('Tvoj vyber: cisla a pismena...');
       write('Zadaj dlzku hesla (max.1000): ');
       readln(dch);
     until (dch>0) and (dch<1001);
 
     repeat
       randomize;
       cp:=random(2)+1;
       if cp=1 then begin
                     c:=random(10);
                     write(c:1:0);
                     write(heslo,c:1:0);
                     delay(70);
                     pp:=pp+1;
                    end;
 
       if cp=2 then begin
                     p:=random(26)+1;
                     if p=1 then begin write('A'); write(heslo,'A'); end;
                     if p=2 then begin write('B'); write(heslo,'B'); end;
                     if p=3 then begin write('C'); write(heslo,'C'); end;
                     if p=4 then begin write('D'); write(heslo,'D'); end;
                     if p=5 then begin write('E'); write(heslo,'E'); end;
                     if p=6 then begin write('F'); write(heslo,'F'); end;
                     if p=7 then begin write('G'); write(heslo,'G'); end;
                     if p=8 then begin write('H'); write(heslo,'H'); end;
                     if p=9 then begin write('I'); write(heslo,'I'); end;
                     if p=10 then begin write('J'); write(heslo,'J'); end;
                     if p=11 then begin write('K'); write(heslo,'K'); end;
                     if p=12 then begin write('L'); write(heslo,'L'); end;
                     if p=13 then begin write('M'); write(heslo,'M'); end;
                     if p=14 then begin write('N'); write(heslo,'N'); end;
                     if p=15 then begin write('O'); write(heslo,'O'); end;
                     if p=16 then begin write('P'); write(heslo,'P'); end;
                     if p=17 then begin write('Q'); write(heslo,'Q'); end;
                     if p=18 then begin write('R'); write(heslo,'R'); end;
                     if p=19 then begin write('S'); write(heslo,'S'); end;
                     if p=20 then begin write('T'); write(heslo,'T'); end;
                     if p=21 then begin write('U'); write(heslo,'U'); end;
                     if p=22 then begin write('V'); write(heslo,'V'); end;
                     if p=23 then begin write('W'); write(heslo,'W'); end;
                     if p=24 then begin write('X'); write(heslo,'X'); end;
                     if p=25 then begin write('Y'); write(heslo,'Y'); end;
                     if p=26 then begin write('Z'); write(heslo,'Z'); end;
                     delay(70);
                     pp:=pp+1;
                    end;
     until dch=pp;
  end;               { if chcem=2 }
 
  if chcem=3 then begin
                    repeat
                      ClrScr;
                      writeln('Tvoj vyber: iba pismena...');
                      writeln('Zadaj dlzku hesla (max.1000): ');
                      readln(dch);
                    until (dch>0) and (dch<1001);
 
                    repeat
                      p:=random(26)+1;
                      if p=1 then begin write('A'); write(heslo,'A'); end;
                      if p=2 then begin write('B'); write(heslo,'B'); end;
                      if p=3 then begin write('C'); write(heslo,'C'); end;
                      if p=4 then begin write('D'); write(heslo,'D'); end;
                      if p=5 then begin write('E'); write(heslo,'E'); end;
                      if p=6 then begin write('F'); write(heslo,'F'); end;
                      if p=7 then begin write('G'); write(heslo,'G'); end;
                      if p=8 then begin write('H'); write(heslo,'H'); end;
                      if p=9 then begin write('I'); write(heslo,'I'); end;
                      if p=10 then begin write('J'); write(heslo,'J'); end;
                      if p=11 then begin write('K'); write(heslo,'K'); end;
                      if p=12 then begin write('L'); write(heslo,'L'); end;
                      if p=13 then begin write('M'); write(heslo,'M'); end;
                      if p=14 then begin write('N'); write(heslo,'N'); end;
                      if p=15 then begin write('O'); write(heslo,'O'); end;
                      if p=16 then begin write('P'); write(heslo,'P'); end;
                      if p=17 then begin write('Q'); write(heslo,'Q'); end;
                      if p=18 then begin write('R'); write(heslo,'R'); end;
                      if p=19 then begin write('S'); write(heslo,'S'); end;
                      if p=20 then begin write('T'); write(heslo,'T'); end;
                      if p=21 then begin write('U'); write(heslo,'U'); end;
                      if p=22 then begin write('V'); write(heslo,'V'); end;
                      if p=23 then begin write('W'); write(heslo,'W'); end;
                      if p=24 then begin write('X'); write(heslo,'X'); end;
                      if p=25 then begin write('Y'); write(heslo,'Y'); end;
                      if p=26 then begin write('Z'); write(heslo,'Z'); end;
                      pp:=pp+1;
                      delay(70);
                    until pp=dch;
  end;
 
  writeln;
  writeln('Heslo bolo ulozene v textovom subore s nazvom HESLO.TXT, vedla programu');
  gotoxy(34,12);
  writeln('PRESS ANY KEY...');
  delay(500);
  gotoxy(1,25);
  textcolor(12);
  write('Software by FURBY');
  writeln(heslo,' ');
  writeln(heslo,'Software by FURBY');
  textcolor(15);
  Close(heslo);
  readkey;
end.