133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
ofSize: (size_t)size
{
uint32_t t;
if (size == 0)
return;
if (calculated)
@throw [OFHashAlreadyCalculatedException newWithClass: isa];
/* Update bitcount */
t = bits[0];
if ((bits[0] = t + ((uint32_t)size << 3)) < t)
/* Carry from low to high */
bits[1]++;
|
|
|
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
ofSize: (size_t)size
{
uint32_t t;
if (size == 0)
return;
if (isCalculated)
@throw [OFHashAlreadyCalculatedException newWithClass: isa];
/* Update bitcount */
t = bits[0];
if ((bits[0] = t + ((uint32_t)size << 3)) < t)
/* Carry from low to high */
bits[1]++;
|
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
}
- (uint8_t*)digest
{
uint8_t *p;
size_t count;
if (calculated)
return (uint8_t*)buf;
/* Compute number of bytes mod 64 */
count = (bits[0] >> 3) & 0x3F;
/*
* Set the first char of padding to 0x80. This is safe since there is
|
|
|
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
}
- (uint8_t*)digest
{
uint8_t *p;
size_t count;
if (isCalculated)
return (uint8_t*)buf;
/* Compute number of bytes mod 64 */
count = (bits[0] >> 3) & 0x3F;
/*
* Set the first char of padding to 0x80. This is safe since there is
|
222
223
224
225
226
227
228
229
230
231
232
233
|
/* Append length in bits and transform */
((uint32_t*)in)[14] = bits[0];
((uint32_t*)in)[15] = bits[1];
md5_transform(buf, (uint32_t*)in);
OF_BSWAP32_V_IF_BE(buf, 4);
calculated = YES;
return (uint8_t*)buf;
}
@end
|
|
|
222
223
224
225
226
227
228
229
230
231
232
233
|
/* Append length in bits and transform */
((uint32_t*)in)[14] = bits[0];
((uint32_t*)in)[15] = bits[1];
md5_transform(buf, (uint32_t*)in);
OF_BSWAP32_V_IF_BE(buf, 4);
isCalculated = YES;
return (uint8_t*)buf;
}
@end
|