X-Git-Url: https://jxself.org/git/?p=skeinsum.git;a=blobdiff_plain;f=skein_cli.c;fp=skein_cli.c;h=d6e7649480d4b930cf53cd415ac606a5283fd9ca;hp=0ab840835690951179942431663d506041ab4fba;hb=6f9f4910116e2463dc4f9c842177fdf3e5b4ebae;hpb=ff93bbdae2026ff865e07c05450560d0594d935a diff --git a/skein_cli.c b/skein_cli.c index 0ab8408..d6e7649 100644 --- a/skein_cli.c +++ b/skein_cli.c @@ -283,17 +283,18 @@ int VerifyHashesFromFile(FILE *fp, int status, int warn, int quiet) return (NotProper || NoMatch) ? -1 : 1; } -int isProper(char MsgDigest[]) +int isProper(const char MsgDigest[]) { - if ((strlen(MsgDigest) - hashbitlen/4) != 0) + int len = strlen(MsgDigest); + if (len != (hashbitlen / 4)) return 0; int index = 0; - char c = 0; - for(index = 0; index < strlen(MsgDigest);index++) + for (index = 0; index < len; index++) { - c = MsgDigest[index]; - if(!(( c >= '0' && c <= '9' ) || ( c >= 'A' && c <= 'F'))) - return 0; + char c = MsgDigest[index]; + if (c >= '0' && c <= '9') continue; + if (c >= 'A' && c <= 'F') continue; + return 0; } return 1;