MCPcopy Create free account
hub / github.com/F-Stack/f-stack / SipRounds

Function SipRounds

freebsd/crypto/siphash/siphash.c:212–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210#define SIP_ROTL(x, b) (uint64_t)(((x) << (b)) | ( (x) >> (64 - (b))))
211
212static void
213SipRounds(SIPHASH_CTX *ctx, int final)
214{
215 int rounds;
216
217 if (!final)
218 rounds = ctx->rounds_compr;
219 else
220 rounds = ctx->rounds_final;
221
222 while (rounds--) {
223 ctx->v[0] += ctx->v[1];
224 ctx->v[2] += ctx->v[3];
225 ctx->v[1] = SIP_ROTL(ctx->v[1], 13);
226 ctx->v[3] = SIP_ROTL(ctx->v[3], 16);
227
228 ctx->v[1] ^= ctx->v[0];
229 ctx->v[3] ^= ctx->v[2];
230 ctx->v[0] = SIP_ROTL(ctx->v[0], 32);
231
232 ctx->v[2] += ctx->v[1];
233 ctx->v[0] += ctx->v[3];
234 ctx->v[1] = SIP_ROTL(ctx->v[1], 17);
235 ctx->v[3] = SIP_ROTL(ctx->v[3], 21);
236
237 ctx->v[1] ^= ctx->v[2];
238 ctx->v[3] ^= ctx->v[0];
239 ctx->v[2] = SIP_ROTL(ctx->v[2], 32);
240 }
241}
242

Callers 3

SipBufFunction · 0.85
SipHash_UpdateFunction · 0.85
SipHash_EndFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected