Differences From Artifact [4360879e92]:
- File
src/OFSHA1Hash.m
— part of check-in
[44f45c2e35]
at
2017-01-09 17:36:36
on branch trunk
— Update copyright
Forgot to add 2017, even though I already did quite some changes in
2017. (user: js, size: 4119) [annotate] [blame] [check-ins using]
To 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]
︙ | ︙ | |||
138 139 140 141 142 143 144 | _state[0] = 0x67452301; _state[1] = 0xEFCDAB89; _state[2] = 0x98BADCFE; _state[3] = 0x10325476; _state[4] = 0xC3D2E1F0; } | | | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | _state[0] = 0x67452301; _state[1] = 0xEFCDAB89; _state[2] = 0x98BADCFE; _state[3] = 0x10325476; _state[4] = 0xC3D2E1F0; } - (void)updateWithBuffer: (const void *)buffer_ length: (size_t)length { const uint8_t *buffer = buffer_; if (_calculated) @throw [OFHashAlreadyCalculatedException exceptionWithObject: self]; |
︙ | ︙ | |||
168 169 170 171 172 173 174 | if (_bufferLength == 64) { processBlock(_state, _buffer.words); _bufferLength = 0; } } } | | | | | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | if (_bufferLength == 64) { processBlock(_state, _buffer.words); _bufferLength = 0; } } } - (const unsigned char *)digest { if (_calculated) return (const uint8_t *)_state; _buffer.bytes[_bufferLength] = 0x80; memset(_buffer.bytes + _bufferLength + 1, 0, 64 - _bufferLength - 1); if (_bufferLength >= 56) { processBlock(_state, _buffer.words); memset(_buffer.bytes, 0, 64); } _buffer.words[14] = OF_BSWAP32_IF_LE((uint32_t)(_bits >> 32)); _buffer.words[15] = OF_BSWAP32_IF_LE((uint32_t)(_bits & 0xFFFFFFFF)); processBlock(_state, _buffer.words); memset(&_buffer, 0, sizeof(_buffer)); byteSwapVectorIfLE(_state, 5); _calculated = true; return (const uint8_t *)_state; } - (void)reset { [self OF_resetState]; _bits = 0; memset(&_buffer, 0, sizeof(_buffer)); _bufferLength = 0; _calculated = false; } @end |