2023年7月31日发(作者:)

#include"stdio.h"

#include"time.h"

#include"stdlib.h"

#include"malloc.h"

#include"string.h"

int main()

{

char

a[10],b[]={"000000"},c[]={"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"};

int d[6];

clock_t start,finish;

double TheTimes;

do

{

printf("请输入六位密码:");

gets(a);

if(a[6]=='0')

{

break;

}

printf("ERRORn" );

}

while(1);

start=clock();

while(1)

{

for(d[5]=0;d[5]<64;d[5]++)

{

b[5]=c[d[5]];

for(d[4]=0;d[4]<64;d[4]++)

{

b[4]=c[d[4]];

for(d[3]=0;d[3]<64;d[3]++)

{

b[3]=c[d[3]];

for(d[2]=0;d[2]<64;d[2]++)

{

b[2]=c[d[2]];

for(d[1]=0;d[1]<64;d[1]++)

{

b[1]=c[d[1]];

for(d[0]=0;d[0]<64;d[0]++)

{

b[0]=c[d[0]];

if(strcmp(a,b)==0)

{

printf("破解密码得:");

puts(b);

finish=clock();

}

}

}

return(0);

}

} }

}

TheTimes=(double)((finish-start)/CLOCKS_PER_SEC);

printf("用时%f秒。n",TheTimes);

return(0);

}

}

2023年7月31日发(作者:)

#include"stdio.h"

#include"time.h"

#include"stdlib.h"

#include"malloc.h"

#include"string.h"

int main()

{

char

a[10],b[]={"000000"},c[]={"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"};

int d[6];

clock_t start,finish;

double TheTimes;

do

{

printf("请输入六位密码:");

gets(a);

if(a[6]=='0')

{

break;

}

printf("ERRORn" );

}

while(1);

start=clock();

while(1)

{

for(d[5]=0;d[5]<64;d[5]++)

{

b[5]=c[d[5]];

for(d[4]=0;d[4]<64;d[4]++)

{

b[4]=c[d[4]];

for(d[3]=0;d[3]<64;d[3]++)

{

b[3]=c[d[3]];

for(d[2]=0;d[2]<64;d[2]++)

{

b[2]=c[d[2]];

for(d[1]=0;d[1]<64;d[1]++)

{

b[1]=c[d[1]];

for(d[0]=0;d[0]<64;d[0]++)

{

b[0]=c[d[0]];

if(strcmp(a,b)==0)

{

printf("破解密码得:");

puts(b);

finish=clock();

}

}

}

return(0);

}

} }

}

TheTimes=(double)((finish-start)/CLOCKS_PER_SEC);

printf("用时%f秒。n",TheTimes);

return(0);

}

}