Differences From Artifact [766775fc8c]:
- File
src/OFSHA1Hash.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: 4123) [annotate] [blame] [check-ins using]
To Artifact [cd2db0fc50]:
- File
src/OFSHA1Hash.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: 4177) [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 "OFSHA1Hash.h" #import "OFHashAlreadyCalculatedException.h" #define F(a, b, c, d) ((d) ^ ((b) & ((c) ^ (d)))) #define G(a, b, c, d) ((b) ^ (c) ^ (d)) #define H(a, b, c, d) (((b) & (c)) | ((d) & ((b) | (c)))) #define I(a, b, c, d) ((b) ^ (c) ^ (d)) static OF_INLINE void | > > > > | 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 "OFSHA1Hash.h" #import "OFHashAlreadyCalculatedException.h" @interface OFSHA1Hash () - (void)of_resetState; @end #define F(a, b, c, d) ((d) ^ ((b) & ((c) ^ (d)))) #define G(a, b, c, d) ((b) ^ (c) ^ (d)) #define H(a, b, c, d) (((b) & (c)) | ((d) & ((b) | (c)))) #define I(a, b, c, d) ((b) ^ (c) ^ (d)) static OF_INLINE void |
︙ | ︙ | |||
104 105 106 107 108 109 110 | return [[[self alloc] init] autorelease]; } - init { self = [super init]; | | | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | return [[[self alloc] init] autorelease]; } - init { self = [super init]; [self of_resetState]; return self; } - (void)dealloc { [self reset]; |
︙ | ︙ | |||
129 130 131 132 133 134 135 | memcpy(©->_buffer, &_buffer, sizeof(_buffer)); copy->_bufferLength = _bufferLength; copy->_calculated = _calculated; return copy; } | | | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | 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; } |
︙ | ︙ | |||
194 195 196 197 198 199 200 | _calculated = true; return (const uint8_t *)_state; } - (void)reset { | | | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | _calculated = true; return (const uint8_t *)_state; } - (void)reset { [self of_resetState]; _bits = 0; memset(&_buffer, 0, sizeof(_buffer)); _bufferLength = 0; _calculated = false; } @end |