tu peux créer un code pour créer une clé aléatoire du genre:
srand(time(NULL)); //A EXECUTER UNE SEULE FOIS
unsigned long K_SIZE=128; //Nombre de caractères (longueur de clé)
unsigned short C_KEY=0; //"Numèro" du caractère
unsigned long KEY_N=0;
char G_KEY[2049]; //Clé generée
while(KEY_N!=K_SIZE)
{
C_KEY=(rand()%(1-36))+0;
if(C_KEY==1)strcat(G_KEY,"a");
if(C_KEY==2)strcat(G_KEY,"b");
if(C_KEY==3)strcat(G_KEY,"c");
if(C_KEY==4)strcat(G_KEY,"d");
if(C_KEY==5)strcat(G_KEY,"e");
if(C_KEY==6)strcat(G_KEY,"f");
if(C_KEY==7)strcat(G_KEY,"g");
if(C_KEY==8)strcat(G_KEY,"h");
if(C_KEY==9)strcat(G_KEY,"i");
if(C_KEY==10)strcat(G_KEY,"j");
if(C_KEY==11)strcat(G_KEY,"k");
if(C_KEY==12)strcat(G_KEY,"l");
if(C_KEY==13)strcat(G_KEY,"m");
if(C_KEY==14)strcat(G_KEY,"n");
if(C_KEY==15)strcat(G_KEY,"o");
if(C_KEY==16)strcat(G_KEY,"p");
if(C_KEY==17)strcat(G_KEY,"q");
if(C_KEY==18)strcat(G_KEY,"r");
if(C_KEY==19)strcat(G_KEY,"s");
if(C_KEY==20)strcat(G_KEY,"t");
if(C_KEY==21)strcat(G_KEY,"u");
if(C_KEY==22)strcat(G_KEY,"v");
if(C_KEY==23)strcat(G_KEY,"w");
if(C_KEY==24)strcat(G_KEY,"x");
if(C_KEY==25)strcat(G_KEY,"y");
if(C_KEY==26)strcat(G_KEY,"z");
if(C_KEY==27)strcat(G_KEY,"0");
if(C_KEY==28)strcat(G_KEY,"1");
if(C_KEY==29)strcat(G_KEY,"2");
if(C_KEY==30)strcat(G_KEY,"3");
if(C_KEY==31)strcat(G_KEY,"4");
if(C_KEY==32)strcat(G_KEY,"5");
if(C_KEY==33)strcat(G_KEY,"6");
if(C_KEY==34)strcat(G_KEY,"7");
if(C_KEY==35)strcat(G_KEY,"8");
if(C_KEY==36)strcat(G_KEY,"9");
KEY_N++;
}
cout << "ID: " << G_KEY << endl;
system("pause>nul");
-->Message édité par socket25 le 17/11/2008 08:35:40<--