Etichetă: generate password any language

Generate Random Password 10++ languages

This article has been written before more than 24months, information might old.

M-am gandit sa scriu o functie de generare password in cate limbaje de programare / scripting pot Pana acum l-am scris in : c/c++ , VB , C# , Boo , Autoit , Ahl , Pawn , javascript , thin basic , visual basic script , WinBatch , Php , Python , Ruby , si o sa il mai scriu si in altele .
Acum codul :

C++ :

#include <iostream>
#include <string>
#include <time.h>
using namespace std;

string GenPass(int Size, bool Numbers , bool UpperLetters )  {
if(Size > 50) Size = 50;
srand ( (unsigned) time(NULL) );
string s= "";
if(Numbers){
if(UpperLetters){
for(int i=0;i<Size;i++){
	switch(rand() % 3 + 1){
	case 1: s.append(1,(char)(rand()%(57-48+1))+48);break; // Numbers
	case 2: s.append(1,(char)(rand()%(122-97+1))+97);break; // Lower Letters
	case 3: s.append(1,(char)(rand()%(90-65+1))+65);break; // Uper Letters
	default: s.append(1,(char)0);break;
}}}else{
for(int i=0;i<Size;i++){
	switch(rand() % 2 + 1){
	case 1: s.append(1,(char)(rand()%(57-48+1))+48);break; // Numbers
	case 2: s.append(1,(char)(rand()%(122-97+1))+97);break; // Lower Letters
	default: s.append(1,(char)0);break;
}}
}}else{
if(UpperLetters){
for(int i=0;i<Size;i++){
	switch(rand() % 2 + 1){
	case 1: s.append(1,(char)(rand()%(122-97+1))+97);break; // Lower Letters
	case