ObjFW  Diff

Differences From Artifact [fe019671c9]:

To Artifact [e2ddd0324e]:


47
48
49
50
51
52
53
54

55
56
57
58
59
60
61
47
48
49
50
51
52
53

54
55
56
57
58
59
60
61







-
+







	    @"--sha384|--sha512] file1 [file2 ...]",
	    @"prog", [OFApplication programName])];

	[OFApplication terminateWithStatus: 1];
}

static void
printHash(OFString *algo, OFString *path, id <OFCryptoHash> hash)
printHash(OFString *algo, OFString *path, id <OFCryptographicHash> hash)
{
	const unsigned char *digest = hash.digest;
	size_t digestSize = hash.digestSize;

	[of_stdout writeFormat: @"%@ ", algo];

	for (size_t i = 0; i < digestSize; i++)
144
145
146
147
148
149
150
151

152
153
154

155
156
157

158
159
160

161
162
163

164
165
166

167
168
169

170
171
172
173
174
175
176
144
145
146
147
148
149
150

151
152
153

154
155


156
157


158
159


160
161


162
163


164
165
166
167
168
169
170
171







-
+


-
+

-
-
+

-
-
+

-
-
+

-
-
+

-
-
+







	    !calculateSHA512)
		help();

	if (optionsParser.remainingArguments.count < 1)
		help();

	if (calculateMD5)
		MD5Hash = [OFMD5Hash cryptoHashWithAllowsSwappableMemory: true];
		MD5Hash = [OFMD5Hash hashWithAllowsSwappableMemory: true];
	if (calculateRIPEMD160)
		RIPEMD160Hash =
		    [OFRIPEMD160Hash cryptoHashWithAllowsSwappableMemory: true];
		    [OFRIPEMD160Hash hashWithAllowsSwappableMemory: true];
	if (calculateSHA1)
		SHA1Hash =
		    [OFSHA1Hash cryptoHashWithAllowsSwappableMemory: true];
		SHA1Hash = [OFSHA1Hash hashWithAllowsSwappableMemory: true];
	if (calculateSHA224)
		SHA224Hash =
		    [OFSHA224Hash cryptoHashWithAllowsSwappableMemory: true];
		SHA224Hash = [OFSHA224Hash hashWithAllowsSwappableMemory: true];
	if (calculateSHA256)
		SHA256Hash =
		    [OFSHA256Hash cryptoHashWithAllowsSwappableMemory: true];
		SHA256Hash = [OFSHA256Hash hashWithAllowsSwappableMemory: true];
	if (calculateSHA384)
		SHA384Hash =
		    [OFSHA384Hash cryptoHashWithAllowsSwappableMemory: true];
		SHA384Hash = [OFSHA384Hash hashWithAllowsSwappableMemory: true];
	if (calculateSHA512)
		SHA512Hash =
		    [OFSHA512Hash cryptoHashWithAllowsSwappableMemory: true];
		SHA512Hash = [OFSHA512Hash hashWithAllowsSwappableMemory: true];

	for (OFString *path in optionsParser.remainingArguments) {
		void *pool = objc_autoreleasePoolPush();
		OFStream *file;

		if ([path isEqual: @"-"])
			file = of_stdin;