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,1,0,0,0,0,1,1,1,0,1,0,},
{0,0,1,0,0,1,1,1,1,0,1,0,1,0,0,0,0,1,0,0,1,1,0,1,0,0,1,0,0,},
{1,0,1,1,0,1,0,0,1,0,0,1,0,0,0,0,1,0,1,1,0,0,1,0,1,1,1,1,0,},
{1,0,0,0,1,1,1,1,1,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,},
{1,0,0,0,1,1,0,1,1,0,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,0,1,1,},
{1,0,1,1,1,0,1,0,1,0,1,0,1,1,0,1,1,0,0,0,1,1,1,1,1,0,1,0,0,},
{0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,1,0,0,0,1,1,1,0,1,},
{1,1,1,1,1,1,1,0,0,0,1,0,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,0,},
{1,0,0,0,0,0,1,0,0,0,1,0,1,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,1,},
{1,0,1,1,1,0,1,0,1,0,0,1,1,0,1,0,1,1,0,0,1,1,1,1,1,1,1,0,0,},
{1,0,1,1,1,0,1,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,1,1,0,0,0,},
{1,0,1,1,1,0,1,0,1,0,1,0,0,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,},
{1,0,0,0,0,0,1,0,0,1,0,1,1,1,0,1,1,1,1,1,1,0,0,1,1,1,0,1,0,},
{1,1,1,1,1,1,1,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,1,1,0,1,0,1,},
};
int main(int argc, char *argv[])
{
struct timeb start;
struct timeb end;
ftime( & start);
unsigned char iWidth = 29;
char* iData = (char*)malloc(SCHAR * iWidth * iWidth);
int i,j;
for(i=0;i<iWidth;i++)
for(j=0;j<iWidth;j++)
*(iData+i*iWidth+j) = data[i][j];
Cstr text;
char pass[7] = {'\0'};
Cstr_init(&text);
printf("Encrypt=%d\n",decode(iData, iWidth, &text, pass));
printf("text=%s\n",text.str);
printf("pass=%s\n",pass);
Cstr_cleanup(&text);
free(iData);
ftime(&end);printf ("耗时(ms) : %d\n", (int) ((end.time * 1000 + end.millitm) - (start.time * 1000 + start.millitm)));
system("PAUSE");
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -