470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
|
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
|
-
-
+
+
-
+
-
+
|
[hashO retain];
[pool release];
return [[hashO autorelease] digest];
}
- (OFDataArray*)XMPP_hiWithData: (OFDataArray *)str
salt: (OFDataArray *)salt_
- (OFDataArray*)XMPP_hiWithData: (OFDataArray*)str
salt: (OFDataArray*)salt
iterationCount: (intmax_t)i
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
size_t digestSize = [_hashType digestSize];
uint8_t *result = NULL, *u, *uOld;
intmax_t j, k;
OFDataArray *salty, *tmp, *ret;
result = [self allocMemoryWithSize: digestSize];
@try {
memset(result, 0, digestSize);
salty = [[salt_ copy] autorelease];
salty = [[salt copy] autorelease];
[salty addItems: "\0\0\0\1"
count: 4];
uOld = [self XMPP_HMACWithKey: str
data: salty];
for (j = 0; j < digestSize; j++)
result[j] ^= uOld[j];
for (j = 0; j < i - 1; j++) {
tmp = [OFDataArray new];
tmp = [[OFDataArray alloc] init];
[tmp addItems: uOld
count: digestSize];
[pool releaseObjects]; // releases uOld and previous tmp
[tmp autorelease];
u = [self XMPP_HMACWithKey: str
|