- int index_files = 0;
- while(index_files < number_files)
- {
- FILE *fp;
- char hash[500], file_name[100], file_tmp[100], MsgDigest_tmp[hashbitlen/2];
- int NoMatch = 0, NotProper = 0, Computed = 0;
- strcpy(file_name,list_files[index_files]);
- //show everything
- int line = 0;
- fp = fopen(file_name,"r");
- if(fp!=NULL)
- {
- while(fgets(hash,500,fp)!=NULL)
- {
- line ++;
- Computed++;
- unsigned int hashVersion = decomposeHashLine(hash,MsgDigest_tmp,file_tmp);
- if(hashVersion == -1)
- {
- printf("skein%d: %s is using newer version of skein%d algorithm\n",hashbitlen,file_tmp,hashbitlen);
- printf("You should update your algorithm\n");
- continue;
- }
- else if( hashVersion == 0)
- {
- printf("skein%d: %s is using an older version of skein%d algorithm\n",hashbitlen,file_tmp,hashbitlen);
- printf("You should use the older algorithm\n");
- continue;
- }
- else
- {
- if(!isProper(MsgDigest_tmp))
- {
- if(status != 1 && warn == 1)
- {
- printf("skein%dsum: %s: %d: improperly formatted skein%d checksum line\n",hashbitlen,file_tmp,line,hashbitlen);
- }
- NotProper ++;
- NoMatch ++;
- continue;
- }
- if(file_tmp[0] == '*')
- {
- int index_file_tmp = 0;
- for( ; file_tmp[index_file_tmp+1]!=0 ; index_file_tmp++)
- {
- file_tmp[index_file_tmp] = file_tmp[index_file_tmp + 1];
- }
- file_tmp[index_file_tmp] = 0;
- HashBinaryMode(file_tmp,MsgDigest);
- }
- else
- {
- HashTextMode(file_tmp,MsgDigest);
- }
-
- if(!strcmp(MsgDigest,MsgDigest_tmp))
- {
- if(quiet != 1)
- {
- printf("%s: OK\n",file_tmp);
- }
- }
- else
- {
- printf("%s: FAILED\n",file_tmp);
- NoMatch ++;
- }
- }
- }
- if(NoMatch)
- {
- printf("skein%dsum: WARNING: %d of %d computed checksums did NOT match\n",
- hashbitlen,NoMatch,Computed);
- }
- if(NotProper)
- {
- printf("skein%dsum: WARNING: %d line is improperly formatted\n",hashbitlen,NotProper);
- }
- }
- else
- {
- printf("skein%dsum: %s: No such file or directory\n",hashbitlen,file_name);
- }
- index_files++;