ObjFW  Diff

Differences From Artifact [e8adf60118]:

To Artifact [c4ee6e4bc8]:


150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
		  length: (size_t)length
{
	uint32_t t;

	if (length == 0)
		return;

	if (isCalculated)
		@throw [OFHashAlreadyCalculatedException newWithClass: isa
								 hash: self];

	/* Update bitcount */
	t = bits[0];
	if ((bits[0] = t + ((uint32_t)length << 3)) < t)
		/* Carry from low to high */







|







150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
		  length: (size_t)length
{
	uint32_t t;

	if (length == 0)
		return;

	if (calculated)
		@throw [OFHashAlreadyCalculatedException newWithClass: isa
								 hash: self];

	/* Update bitcount */
	t = bits[0];
	if ((bits[0] = t + ((uint32_t)length << 3)) < t)
		/* Carry from low to high */
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
}

- (uint8_t*)digest
{
	uint8_t	*p;
	size_t	count;

	if (isCalculated)
		return (uint8_t*)buffer;

	/* Compute number of bytes mod 64 */
	count = (bits[0] >> 3) & 0x3F;

	/*
	 * Set the first char of padding to 0x80. This is safe since there is







|







202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
}

- (uint8_t*)digest
{
	uint8_t	*p;
	size_t	count;

	if (calculated)
		return (uint8_t*)buffer;

	/* Compute number of bytes mod 64 */
	count = (bits[0] >> 3) & 0x3F;

	/*
	 * Set the first char of padding to 0x80. This is safe since there is
240
241
242
243
244
245
246
247
248
249
250
251
	/* Append length in bits and transform */
	in.u32[14] = bits[0];
	in.u32[15] = bits[1];

	md5_transform(buffer, in.u32);
	of_bswap32_vec_if_be(buffer, 4);

	isCalculated = YES;

	return (uint8_t*)buffer;
}
@end







|




240
241
242
243
244
245
246
247
248
249
250
251
	/* Append length in bits and transform */
	in.u32[14] = bits[0];
	in.u32[15] = bits[1];

	md5_transform(buffer, in.u32);
	of_bswap32_vec_if_be(buffer, 4);

	calculated = YES;

	return (uint8_t*)buffer;
}
@end