Overview
Comment: | Reduce object calls in OFHashes. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
9c0e2dbc573a69fced37a573a232080f |
User & Date: | js on 2008-11-01 18:21:46 |
Other Links: | manifest | tags |
Context
2008-11-01
| ||
18:38 | Only run tests if we're not cross-compiling. check-in: 5a21508a04 user: js tags: trunk | |
18:21 | Reduce object calls in OFHashes. check-in: 9c0e2dbc57 user: js tags: trunk | |
18:10 |
Rename CData -> Data in createStanza:withCloseTag:andData:,... Actually, it can be any data, not only cdata. check-in: 344f03e297 user: js tags: trunk | |
Changes
Modified TODO from [9dfe96e62a] to [e12a5a7d6a].
1 2 3 4 5 6 7 | OFArray OFDictionary OFSortedArray OFSocket OFThread OFAutoreleasePool | > > | 1 2 3 4 5 6 7 8 9 | Tests for OFFile. OFArray OFDictionary OFSortedArray OFSocket OFThread OFAutoreleasePool |
︙ | ︙ |
Modified src/OFHashes.m from [796bcf7704] to [f95a522750].
︙ | ︙ | |||
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | /* Add the working vars back into state[] */ state[0] += a; state[1] += b; state[2] += c; state[3] += d; state[4] += e; } @implementation OFSHA1Hash - init { if ((self = [super init])) { count = 0; state[0] = 0x67452301; state[1] = 0xEFCDAB89; state[2] = 0x98BADCFE; state[3] = 0x10325476; state[4] = 0xC3D2E1F0; } return self; } - updateWithBuffer: (const uint8_t*)buf ofSize: (size_t)size { | > > > > > > > > > > > > > > > > > > > > > > > < < < < | < < < < < < < < < < < < < | < | < | < | 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | /* Add the working vars back into state[] */ state[0] += a; state[1] += b; state[2] += c; state[3] += d; state[4] += e; } static inline void sha1_update(uint8_t buffer, const uint8_t *buf, size_t size) { size_t i, j; j = (size_t)((count >> 3) & 63); count += (size << 3); if ((j + size) > 63) { memcpy(&buffer[j], buf, (i = 64 - j)); sha1_transform(state, buffer); for (; i + 63 < size; i += 64) sha1_transform(state, &buf[i]); j = 0; } else i = 0; memcpy(&buffer[j], &buf[i], size - i); } @implementation OFSHA1Hash - init { if ((self = [super init])) { count = 0; state[0] = 0x67452301; state[1] = 0xEFCDAB89; state[2] = 0x98BADCFE; state[3] = 0x10325476; state[4] = 0xC3D2E1F0; } return self; } - updateWithBuffer: (const uint8_t*)buf ofSize: (size_t)size { if (calculated) return self; if (size == 0) return self; sha1_update(buffer, buf, size); return self; } - (uint8_t*)digest { size_t i; uint8_t finalcount[8]; if (calculated) return digest; for (i = 0; i < 8; i++) /* Endian independent */ finalcount[i] = (uint8_t)((count >> ((7 - (i & 7)) * 8)) & 255); sha1_update(buffer, (const uint8_t*)"\200", 1); while ((count & 504) != 448) sha1_update(buffer, (const uint8_t*)"\0", 1); /* Should cause a sha1_transform() */ sha1_update(buffer, finalcount, 8); for (i = 0; i < SHA1_DIGEST_SIZE; i++) digest[i] = (uint8_t)((state[i >> 2] >> ((3 - (i & 3)) * 8)) & 255); return digest; } |
︙ | ︙ |