From: Jason Self Date: Tue, 15 Sep 2015 22:04:02 +0000 (-0700) Subject: isProper - small changes. X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=6f9f4910116e2463dc4f9c842177fdf3e5b4ebae;p=skeinsum.git isProper - small changes. --- 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;