⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 freq.c

📁 Cryptanalysis Source Code in C
💻 C
字号:
/*Simple Program to determine letter frequency within a text file*//*which is passed as an argument.*//*By Joe Reagle*//* The following code is provided as is. *        It may be copied and modified freely provided that *Joseph M. Reagle Jr. is acknowledged within the code as the *originator.*//*Maybe I could get this to compare these frequencies against the*//*standard frequencies and give 2 or 3 gueses as plain text      *//*correspondance.*/#include <stdio.h>#define sz_M 100main (int argc, char* argv[]){   int  ch=1;   int   counter;   int   data[sz_M][2];   FILE  *ifp;   printf("toden = %d", ' ');   for (counter = 0; counter < sz_M; counter++) {      data[counter][0] = ' ' + counter;       /*Set up the array with letters*/      data[counter][1] = 0;                   /*As the indicy (sp?)*/   }   if ((ifp=fopen (argv[1], "r"))==NULL) {      printf("Cannot open file\n");      exit(1);   }   while ( (ch=fgetc(ifp)) !=EOF) {      data[ch-' '][1]++;                      /*Read in letter and store*/   }   for (counter = 0; counter < sz_M; counter++) {      printf("%c ~ %d \n", data[counter][0],data[counter][1]); /*Print it out*/   }   printf("\n");}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -