我正在将 sha1 破解器作为一个大学项目来实施。我正在使用循环尝试不同的值来获取它们的哈希值。
for(int a=0; a<26; a++)
{
for(int b=0; b<26; b++)
{
for(int c=0; c<26; c++)
{
for(int d=0; d<26; d++)
{
for(int e=0; e<26; e++)
{
for(int f=0; f<26; f++)
{
result[0]=alphabet[a];
result[1]=alphabet[b];
result[2]=alphabet[c];
result[3]=alphabet[d];
result[4]=alphabet[e];
result[5]=alphabet[f];
//printf("result : %s\n candidate %x %x %x %x %x",result,candidate.a,candidate.b,candidate.c,candidate.d,candidate.e);
// Declarations
uint32_t a,b,c,d,e,temp;
uint32_t w[80]= {0};
a=h0;
b=h1;
c=h2;
d=h3;
e=h4;
下面的代码只是正在进行的 SHA-1 代码。外部的循环用于测试每个选项的 6 个字符的单词。
如果我现在尝试uint32_t
在第一个 for 循环之前移动声明行(但仍在同一个函数中,C 编译器会警告我变量未使用并且程序崩溃,因为这些变量似乎在循环中丢失。但出于性能原因,我不想每次都声明它们是新的。如果我尝试全局声明它们,会发生同样的问题。但是当它们在最后一个循环中声明时,一切正常