Differences From Artifact [eb95ce0800]:
- File
src/OFRIPEMD160Hash.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: 5934) [annotate] [blame] [check-ins using]
To Artifact [9e827ae911]:
- File
src/OFRIPEMD160Hash.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: 5993) [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 "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 | return [[[self alloc] init] autorelease]; } - init { self = [super init]; | | | 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 | memcpy(©->_buffer, &_buffer, sizeof(_buffer)); copy->_bufferLength = _bufferLength; copy->_calculated = _calculated; return copy; } | | | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | 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; _state[4] = 0xC3D2E1F0; } |
︙ | ︙ | |||
234 235 236 237 238 239 240 | _calculated = true; return (const uint8_t *)_state; } - (void)reset { | | | 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 |