回复 26楼 VxWorks
求程序
冰冻三尺,非一日之寒;士别三日,不足刮目相看!
#include <stdio.h> int main(void) { FILE * fp; int ch, i = 0, j; static char letters[10000]; char pwd[4] = {0}; if((fp = fopen("cipher1.txt", "r")) == NULL) { perror(NULL); return 0; } do { fscanf(fp, "%d", &ch); letters[i++] = (char)ch; ch = fgetc(fp); } while(EOF != ch); for(pwd[0] = 'a'; pwd[0] <= 'z'; pwd[0]++) { for(pwd[1] = 'a'; pwd[1] <= 'z'; pwd[1]++) { for(pwd[2] = 'a'; pwd[2] <= 'z'; pwd[2]++) { for(j = 0; j < i; j += 3) { letters[j + 0] ^= pwd[0]; letters[j + 1] ^= pwd[1]; letters[j + 2] ^= pwd[2]; } printf("Password: %s\n", pwd); for(j = 0; j < i; j++) printf("%c", letters[j]); printf("\n\n"); for(j = 0; j < i; j += 3) { letters[j + 0] ^= pwd[0]; letters[j + 1] ^= pwd[1]; letters[j + 2] ^= pwd[2]; } } } } fclose(fp); return 0; }