Skip to content

Commit 1b013d2

Browse files
committed
Remove sha256 --skip-end feature as discussed during PR review process
Signed-off-by: DL6ER <[email protected]>
1 parent cdba28e commit 1b013d2

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/args.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -532,21 +532,20 @@ void parse_args(int argc, char* argv[])
532532
}
533533

534534
// sha256sum mode
535-
if((argc == 3 || (argc == 4 && strcmp(argv[2], "--skip-end"))) && strcmp(argv[1], "sha256sum") == 0)
535+
if(argc == 3 && strcmp(argv[1], "sha256sum") == 0)
536536
{
537-
const bool skip_end = argc == 4;
538537
// Enable stdout printing
539538
cli_mode = true;
540539
uint8_t checksum[SHA256_DIGEST_SIZE];
541-
if(!sha256sum(argv[skip_end ? 3 : 2], checksum, skip_end))
540+
if(!sha256sum(argv[2], checksum, false))
542541
exit(EXIT_FAILURE);
543542

544543
// Convert checksum to hex string
545544
char hex[SHA256_DIGEST_SIZE*2+1];
546545
sha256_raw_to_hex(checksum, hex);
547546

548547
// Print result
549-
printf("%s %s\n", hex, argv[skip_end ? 3 : 2]);
548+
printf("%s %s\n", hex, argv[2]);
550549
exit(EXIT_SUCCESS);
551550
}
552551

@@ -1097,12 +1096,11 @@ void parse_args(int argc, char* argv[])
10971096
printf(" Usage: %spihole-FTL ntp %s[server]%s %s[--update]%s\n\n", green, cyan, normal, purple, normal);
10981097

10991098
printf("%sSHA256 checksum tools:%s\n", yellow, normal);
1100-
printf(" Calculates the SHA256 checksum of a file.\n\n");
1099+
printf(" Calculates the SHA256 checksum of a file. The checksum is\n");
1100+
printf(" computed as described in FIPS-180-2 and uses straeaming\n");
1101+
printf(" to allow processing arbitrary large files with a small\n");
1102+
printf(" memory footprint.\n\n");
11011103
printf(" Usage: %spihole-FTL sha256sum %sfile%s\n\n", green, cyan, normal);
1102-
printf(" The special flag %s--skip-end%s can be used to skip the last 32\n", purple, normal);
1103-
printf(" bytes of the file. This is useful for files which have their\n");
1104-
printf(" checksum appended at the end of the file, e.g., pihole-FTL:\n\n");
1105-
printf(" %spihole-FTL sha256sum %s--skip_end %sfile%s\n\n", green, purple, cyan, normal);
11061104

11071105
printf("%sOther:%s\n", yellow, normal);
11081106
printf("\t%sverify%s Verify the integrity of the FTL binary\n", green, normal);

0 commit comments

Comments
 (0)