- char hash[PATH_MAX + hashbitlen/4 + 4];
- char MsgDigest_tmp[hashbitlen/2];
- int NoMatch = 0, NotProper = 0, Computed = 0;
- int line = 0;
-
- while (fgets(hash, sizeof(hash)-1, fp))
- {
- char file_tmp[PATH_MAX];
- line ++;
- Computed++;
- int hashVersion = decomposeHashLine(hash,MsgDigest_tmp,file_tmp);
- if (hashVersion == -1)
- {
- fprintf(stderr, "skein%d: %s is using newer version of skein%d algorithm\n",hashbitlen,file_tmp,hashbitlen);
- fprintf(stderr, "You should update your algorithm\n");
- continue;
- }
- else if (hashVersion == 0)
- {
- fprintf(stderr, "skein%d: %s is using an older version of skein%d algorithm\n",hashbitlen,file_tmp,hashbitlen);
- fprintf(stderr, "You should use the older algorithm\n");
- continue;
- }
- else if (!isProper(MsgDigest_tmp))
- {
- if(status != 1 && warn == 1)
- fprintf(stderr, "skein%dsum: %s: %d: improperly formatted skein%d checksum line\n",hashbitlen,file_tmp,line,hashbitlen);
- NotProper ++;
- NoMatch ++;
- }
- else if (!HashMatch(MsgDigest_tmp, file_tmp, quiet))
- {
- NoMatch++;
- }
- }
- if(NoMatch)
- {
- fprintf(stderr, "skein%dsum: WARNING: %d of %d computed checksums did NOT match\n",
- hashbitlen,NoMatch,Computed);
- }
- if(NotProper)
- {
- fprintf(stderr, "skein%dsum: WARNING: %d line is improperly formatted\n",hashbitlen,NotProper);
- }
- return (NotProper || NoMatch) ? -1 : 1;
-}
-
-int isProper(char MsgDigest[])
-{
- if ((strlen(MsgDigest) - hashbitlen/4) != 0)