@@ -1,7 +1,7 @@ /* - * Copyright (c) 2008-2021 Jonathan Schleifer + * Copyright (c) 2008-2022 Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in @@ -41,22 +41,25 @@ static void help(void) { [OFStdErr writeLine: OF_LOCALIZED(@"usage", - @"Usage: %[prog] [--md5|--ripemd160|--sha1|--sha224|--sha256|" - @"--sha384|--sha512] file1 [file2 ...]", + @"Usage: %[prog] [--md5] [--ripemd160] [--sha1] [--sha224] " + @"[--sha256] [--sha384] [--sha512] file1 [file2 ...]", @"prog", [OFApplication programName])]; [OFApplication terminateWithStatus: 1]; } static void printHash(OFString *algo, OFString *path, id hash) { - const unsigned char *digest = hash.digest; size_t digestSize = hash.digestSize; + const unsigned char *digest; + + [hash calculate]; + digest = hash.digest; [OFStdOut writeFormat: @"%@ ", algo]; for (size_t i = 0; i < digestSize; i++) [OFStdOut writeFormat: @"%02x", digest[i]];