Differences From Artifact [0b7be48688]:
- File
src/OFSHA1Hash.m
— part of check-in
[3d16a30f41]
at
2013-06-22 12:12:36
on branch trunk
— Rework exceptions.
This mostly removes the argument for the class in which the exception
occurred. As backtraces were recently added for all platforms, the
passed class does not give any extra information on where the exception
occurred anymore.This also removes a few other arguments which were not too helpful. In
the past, the idea was to pass as many arguments as possible so that it
is easier to find the origin of the exception. However, as backtraces
are a much better way to find the origin, those are not useful anymore
and just make the exception more cumbersome to use. The rule is now to
only pass arguments that might help in recovering from the exception or
provide information that is otherwise not easily accessible. (user: js, size: 5433) [annotate] [blame] [check-ins using]
To Artifact [4f0ad14fda]:
- File src/OFSHA1Hash.m — part of check-in [75f2aa5096] at 2013-12-08 17:43:19 on branch trunk — Clean up OFHash and the Hashing categories. (user: js, size: 5422) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
166 167 168 169 170 171 172 | if (_calculated) @throw [OFHashAlreadyCalculatedException exceptionWithHash: self]; sha1_update(_state, &_count, _buffer, buffer, length); } | | | | 166 167 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 | if (_calculated) @throw [OFHashAlreadyCalculatedException exceptionWithHash: self]; sha1_update(_state, &_count, _buffer, buffer, length); } - (const uint8_t*)digest { size_t i; char finalcount[8]; if (_calculated) return _digest; for (i = 0; i < 8; i++) /* Endian independent */ finalcount[i] = (char)((_count >> ((7 - (i & 7)) * 8)) & 255); sha1_update(_state, &_count, _buffer, "\200", 1); while ((_count & 504) != 448) sha1_update(_state, &_count, _buffer, "\0", 1); /* Should cause a sha1_transform() */ sha1_update(_state, &_count, _buffer, finalcount, 8); for (i = 0; i < 20; i++) _digest[i] = (char)((_state[i >> 2] >> ((3 - (i & 3)) * 8)) & 255); _calculated = true; return _digest; } - (bool)isCalculated { return _calculated; } @end |