ObjFW  Diff

Differences From Artifact [eb95ce0800]:

To Artifact [9e827ae911]:


17
18
19
20
21
22
23




24
25
26
27
28
29
30
#include "config.h"

#include <string.h>

#import "OFRIPEMD160Hash.h"

#import "OFHashAlreadyCalculatedException.h"





#define F(a, b, c) ((a) ^ (b) ^ (c))
#define G(a, b, c) (((a) & (b)) | (~(a) & (c)))
#define H(a, b, c) (((a) | ~(b)) ^ (c))
#define I(a, b, c) (((a) & (c)) | ((b) & ~(c)))
#define J(a, b, c) ((a) ^ ((b) | ~(c)))








>
>
>
>







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "config.h"

#include <string.h>

#import "OFRIPEMD160Hash.h"

#import "OFHashAlreadyCalculatedException.h"

@interface OFRIPEMD160Hash ()
- (void)of_resetState;
@end

#define F(a, b, c) ((a) ^ (b) ^ (c))
#define G(a, b, c) (((a) & (b)) | (~(a) & (c)))
#define H(a, b, c) (((a) | ~(b)) ^ (c))
#define I(a, b, c) (((a) & (c)) | ((b) & ~(c)))
#define J(a, b, c) ((a) ^ ((b) | ~(c)))

144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
	return [[[self alloc] init] autorelease];
}

- init
{
	self = [super init];

	[self OF_resetState];

	return self;
}

- (void)dealloc
{
	[self reset];







|







148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
	return [[[self alloc] init] autorelease];
}

- init
{
	self = [super init];

	[self of_resetState];

	return self;
}

- (void)dealloc
{
	[self reset];
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
	memcpy(&copy->_buffer, &_buffer, sizeof(_buffer));
	copy->_bufferLength = _bufferLength;
	copy->_calculated = _calculated;

	return copy;
}

- (void)OF_resetState
{
	_state[0] = 0x67452301;
	_state[1] = 0xEFCDAB89;
	_state[2] = 0x98BADCFE;
	_state[3] = 0x10325476;
	_state[4] = 0xC3D2E1F0;
}







|







173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
	memcpy(&copy->_buffer, &_buffer, sizeof(_buffer));
	copy->_bufferLength = _bufferLength;
	copy->_calculated = _calculated;

	return copy;
}

- (void)of_resetState
{
	_state[0] = 0x67452301;
	_state[1] = 0xEFCDAB89;
	_state[2] = 0x98BADCFE;
	_state[3] = 0x10325476;
	_state[4] = 0xC3D2E1F0;
}
234
235
236
237
238
239
240
241
242
243
244
245
246
247
	_calculated = true;

	return (const uint8_t *)_state;
}

- (void)reset
{
	[self OF_resetState];
	_bits = 0;
	memset(&_buffer, 0, sizeof(_buffer));
	_bufferLength = 0;
	_calculated = false;
}
@end







|






238
239
240
241
242
243
244
245
246
247
248
249
250
251
	_calculated = true;

	return (const uint8_t *)_state;
}

- (void)reset
{
	[self of_resetState];
	_bits = 0;
	memset(&_buffer, 0, sizeof(_buffer));
	_bufferLength = 0;
	_calculated = false;
}
@end