Differences From Artifact [003b801911]:
- File
src/OFMD5Hash.m
— part of check-in
[4af49a13c3]
at
2017-05-07 20:10:13
on branch trunk
— Small code style change
Casts are now written like types in variable declarations. (user: js, size: 5086) [annotate] [blame] [check-ins using]
To Artifact [5fa8ef5288]:
- File
src/OFMD5Hash.m
— part of check-in
[6b77a5dd8b]
at
2017-05-21 21:28:57
on branch trunk
— Prefix private methods with of_ instead of OF_
This matches Apple's style. (user: js, size: 5139) [annotate] [blame] [check-ins using]
| ︙ | ︙ | |||
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 |
return [[[self alloc] init] autorelease];
}
- init
{
self = [super init];
| | | 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 | memcpy(©->_buffer, &_buffer, sizeof(_buffer)); copy->_bufferLength = _bufferLength; copy->_calculated = _calculated; return copy; } | | | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
memcpy(©->_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 |
_calculated = true;
return (const uint8_t *)_state;
}
- (void)reset
{
| | | 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
|