Simplify sha*sum.c
This commit is contained in:
parent
8e016fad91
commit
e77f0b0b9f
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user