Simplify sha*sum.c

This commit is contained in:
FRIGN 2015-02-17 10:08:28 +01:00
parent 8e016fad91
commit e77f0b0b9f
3 changed files with 3 additions and 9 deletions

View File

@ -25,18 +25,16 @@ main(int argc, char *argv[])
{ {
uint8_t md[SHA1_DIGEST_LENGTH]; uint8_t md[SHA1_DIGEST_LENGTH];
char *checkfile = NULL; char *checkfile = NULL;
int cflag = 0;
ARGBEGIN { ARGBEGIN {
case 'c': case 'c':
cflag = 1;
checkfile = ARGF(); checkfile = ARGF();
break; break;
default: default:
usage(); usage();
} ARGEND; } ARGEND;
if (cflag) if (checkfile)
return cryptcheck(checkfile, argc, argv, &sha1_ops, md, sizeof(md)); return cryptcheck(checkfile, argc, argv, &sha1_ops, md, sizeof(md));
return cryptmain(argc, argv, &sha1_ops, md, sizeof(md)); return cryptmain(argc, argv, &sha1_ops, md, sizeof(md));
} }

View File

@ -25,18 +25,16 @@ main(int argc, char *argv[])
{ {
uint8_t md[SHA256_DIGEST_LENGTH]; uint8_t md[SHA256_DIGEST_LENGTH];
char *checkfile = NULL; char *checkfile = NULL;
int cflag = 0;
ARGBEGIN { ARGBEGIN {
case 'c': case 'c':
cflag = 1;
checkfile = ARGF(); checkfile = ARGF();
break; break;
default: default:
usage(); usage();
} ARGEND; } ARGEND;
if (cflag) if (checkfile)
return cryptcheck(checkfile, argc, argv, &sha256_ops, md, sizeof(md)); return cryptcheck(checkfile, argc, argv, &sha256_ops, md, sizeof(md));
return cryptmain(argc, argv, &sha256_ops, md, sizeof(md)); return cryptmain(argc, argv, &sha256_ops, md, sizeof(md));
} }

View File

@ -25,18 +25,16 @@ main(int argc, char *argv[])
{ {
uint8_t md[SHA512_DIGEST_LENGTH]; uint8_t md[SHA512_DIGEST_LENGTH];
char *checkfile = NULL; char *checkfile = NULL;
int cflag = 0;
ARGBEGIN { ARGBEGIN {
case 'c': case 'c':
cflag = 1;
checkfile = ARGF(); checkfile = ARGF();
break; break;
default: default:
usage(); usage();
} ARGEND; } ARGEND;
if (cflag) if (checkfile)
return cryptcheck(checkfile, argc, argv, &sha512_ops, md, sizeof(md)); return cryptcheck(checkfile, argc, argv, &sha512_ops, md, sizeof(md));
return cryptmain(argc, argv, &sha512_ops, md, sizeof(md)); return cryptmain(argc, argv, &sha512_ops, md, sizeof(md));
} }