80 #pragma warning (disable: 4146) 84 #define SPH_XCAT(a, b) SPH_XCAT_(a, b) 86 #define SPH_XCAT_(a, b) a ## b 90 #if defined BE64 || defined LE64 100 #define SPH_BLEN BLEN 105 #define SPH_MAXPAD (SPH_BLEN - SPH_WLEN) 107 #define SPH_MAXPAD (SPH_BLEN - (SPH_WLEN << 2)) 109 #define SPH_MAXPAD (SPH_BLEN - (SPH_WLEN << 1)) 116 #define SPH_NO_OUTPUT 1 118 #define SPH_VAL sc->val 125 SPH_XCAT(
HASH, _short)(
void *cc,
const void *data,
size_t len)
136 current = (unsigned)sc->count & (
SPH_BLEN - 1U);
138 current = (unsigned)sc->count_low & (
SPH_BLEN - 1U);
149 memcpy(sc->buf + current, data, clen);
150 data = (
const unsigned char *)data + clen;
160 clow = sc->count_low;
162 sc->count_low = clow2;
171 SPH_XCAT(sph_,
HASH)(
void *cc,
const void *data,
size_t len)
186 current = (unsigned)sc->count & (
SPH_BLEN - 1U);
188 current = (unsigned)sc->count_low & (
SPH_BLEN - 1U);
195 data = (
const unsigned char *)data + t;
199 if (((SPH_UPTR)data & (
SPH_WLEN - 1U)) != 0) {
208 data = (
const unsigned char *)data +
SPH_BLEN;
211 memcpy(sc->buf, data, len);
213 sc->count += (sph_u64)orig_len;
215 clow = sc->count_low;
216 clow2 =
SPH_T32(clow + orig_len);
217 sc->count_low = clow2;
227 sc->count_high += orig_len;
240 unsigned ub,
unsigned n,
void *dst,
unsigned rnum)
250 current = (unsigned)sc->count & (
SPH_BLEN - 1U);
252 current = (unsigned)sc->count_low & (
SPH_BLEN - 1U);
255 sc->buf[current ++] = (0x100 | (ub & 0xFF)) >> (8 - n);
261 sc->buf[current ++] = ((ub & -z) | z) & 0xFF;
265 memset(sc->buf + current, 0,
SPH_BLEN - current);
269 memset(sc->buf + current, 0,
SPH_MAXPAD - current);
274 SPH_T64(sc->count << 3) + (sph_u64)n);
280 SPH_T64(sc->count << 3) + (sph_u64)n);
282 sph_enc64be_aligned(sc->buf +
SPH_MAXPAD, sc->count >> 61);
284 SPH_T64(sc->count << 3) + (sph_u64)n);
289 SPH_T64(sc->count << 3) + (sph_u64)n);
292 SPH_T64(sc->count << 3) + (sph_u64)n);
297 SPH_T64(sc->count << 3) + (sph_u64)n);
304 SPH_T64(sc->count << 3) + (sph_u64)n);
307 SPH_T64(sc->count << 3) + (sph_u64)n);
311 high =
SPH_T32((sc->count_high << 3) | (low >> 29));
328 for (u = 0; u < rnum; u ++) {
330 sph_enc64be((
unsigned char *)dst + 8 * u, sc->val[u]);
332 sph_enc64le((
unsigned char *)dst + 8 * u, sc->val[u]);
334 sph_enc32be((
unsigned char *)dst + 4 * u, sc->val[u]);
336 sph_enc32le((
unsigned char *)dst + 4 * u, sc->val[u]);
343 SPH_XCAT(
HASH, _close)(
void *cc,
void *dst,
unsigned rnum)
345 SPH_XCAT(
HASH, _addbits_and_close)(cc, 0, 0, dst, rnum);
void * memcpy(void *a, const void *b, size_t c)