11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include "config.h"
#include <string.h>
#import "OFHashes.h"
#import "OFAutoreleasePool.h"
#import "OFMacros.h"
int _OFHashing_reference;
/*******
* MD5 *
*******/
|
>
|
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include "config.h"
#include <string.h>
#import "OFHashes.h"
#import "OFAutoreleasePool.h"
#import "OFExceptions.h"
#import "OFMacros.h"
int _OFHashing_reference;
/*******
* MD5 *
*******/
|
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
}
- updateWithBuffer: (const char*)buffer
ofSize: (size_t)size
{
uint32_t t;
if (calculated)
return self;
if (size == 0)
return self;
/* Update bitcount */
t = bits[0];
if ((bits[0] = t + ((uint32_t)size << 3)) < t)
/* Carry from low to high */
bits[1]++;
bits[1] += size >> 29;
|
<
<
>
>
>
>
|
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
}
- updateWithBuffer: (const char*)buffer
ofSize: (size_t)size
{
uint32_t t;
if (size == 0)
return self;
if (calculated)
/* FIXME: Maybe a new exception would be better */
@throw [OFInvalidArgumentException newWithClass: isa];
/* Update bitcount */
t = bits[0];
if ((bits[0] = t + ((uint32_t)size << 3)) < t)
/* Carry from low to high */
bits[1]++;
bits[1] += size >> 29;
|
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
|
return self;
}
- updateWithBuffer: (const char*)buf
ofSize: (size_t)size
{
if (calculated)
return self;
if (size == 0)
return self;
sha1_update(state, &count, buffer, buf, size);
return self;
}
- (uint8_t*)digest
{
|
<
<
>
>
>
>
|
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
|
return self;
}
- updateWithBuffer: (const char*)buf
ofSize: (size_t)size
{
if (size == 0)
return self;
if (calculated)
/* FIXME: Maybe a new exception would be better */
@throw [OFInvalidArgumentException newWithClass: isa];
sha1_update(state, &count, buffer, buf, size);
return self;
}
- (uint8_t*)digest
{
|