ObjFW  Diff

Differences From Artifact [003b801911]:

To Artifact [5fa8ef5288]:


17
18
19
20
21
22
23




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

#include <string.h>

#import "OFMD5Hash.h"

#import "OFHashAlreadyCalculatedException.h"





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

static const uint32_t table[] = {







>
>
>
>







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 "OFMD5Hash.h"

#import "OFHashAlreadyCalculatedException.h"

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

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

static const uint32_t table[] = {
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
	return [[[self alloc] init] autorelease];
}

- init
{
	self = [super init];

	[self OF_resetState];

	return self;
}

- (void)dealloc
{
	[self reset];







|







134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
	return [[[self alloc] init] autorelease];
}

- init
{
	self = [super init];

	[self of_resetState];

	return self;
}

- (void)dealloc
{
	[self reset];
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
	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;
}








|







159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
	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;
}

219
220
221
222
223
224
225
226
227
228
229
230
231
232
	_calculated = true;

	return (const uint8_t *)_state;
}

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







|






223
224
225
226
227
228
229
230
231
232
233
234
235
236
	_calculated = true;

	return (const uint8_t *)_state;
}

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