17#ifndef O2_FRAMEWORK_SHA1_H_
18#define O2_FRAMEWORK_SHA1_H_
28#define SHA_rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
32#if BYTE_ORDER == LITTLE_ENDIAN
33#define SHA_blk0(i) (block->l[i] = (SHA_rol(block->l[i], 24) & 0xFF00FF00) | (SHA_rol(block->l[i], 8) & 0x00FF00FF))
34#elif BYTE_ORDER == BIG_ENDIAN
35#define SHA_blk0(i) block->l[i]
37#error "Endianness not defined!"
39#define SHA_blk(i) (block->l[i & 15] = SHA_rol(block->l[(i + 13) & 15] ^ block->l[(i + 8) & 15] ^ block->l[(i + 2) & 15] ^ block->l[i & 15], 1))
42#define SHA_R0(v, w, x, y, z, i) \
43 z += ((w & (x ^ y)) ^ y) + SHA_blk0(i) + 0x5A827999 + SHA_rol(v, 5); \
45#define SHA_R1(v, w, x, y, z, i) \
46 z += ((w & (x ^ y)) ^ y) + SHA_blk(i) + 0x5A827999 + SHA_rol(v, 5); \
48#define SHA_R2(v, w, x, y, z, i) \
49 z += (w ^ x ^ y) + SHA_blk(i) + 0x6ED9EBA1 + SHA_rol(v, 5); \
51#define SHA_R3(v, w, x, y, z, i) \
52 z += (((w | x) & y) | (w & x)) + SHA_blk(i) + 0x8F1BBCDC + SHA_rol(v, 5); \
54#define SHA_R4(v, w, x, y, z, i) \
55 z += (w ^ x ^ y) + SHA_blk(i) + 0xCA62C1D6 + SHA_rol(v, 5); \
69static void SHA1Transform(
71 const unsigned char buffer[64])
81 CHAR64LONG16 block[1];
90 CHAR64LONG16* block = (
const CHAR64LONG16*)
buffer;
186 a =
b =
c =
d =
e = 0;
188 memset(block,
'\0',
sizeof(block));
198 context->state[0] = 0x67452301;
199 context->state[1] = 0xEFCDAB89;
200 context->state[2] = 0x98BADCFE;
201 context->state[3] = 0x10325476;
202 context->state[4] = 0xC3D2E1F0;
203 context->count[0] = context->count[1] = 0;
208static void SHA1Update(
210 const unsigned char*
data,
217 j = context->count[0];
218 if ((context->count[0] +=
len << 3) <
j) {
221 context->count[1] += (
len >> 29);
223 if ((
j +
len) > 63) {
224 memcpy(&context->buffer[
j],
data, (
i = 64 -
j));
225 SHA1Transform(context->state, context->buffer);
226 for (;
i + 63 <
len;
i += 64) {
227 SHA1Transform(context->state, &
data[
i]);
233 memcpy(&context->buffer[
j], &
data[
i],
len -
i);
238static void SHA1Final(
239 unsigned char digest[20],
244 unsigned char finalcount[8];
248 for (
i = 0;
i < 8;
i++) {
249 finalcount[
i] = (
unsigned char)((context->count[(
i >= 4 ? 0 : 1)] >> ((3 - (
i & 3)) * 8)) & 255);
252 SHA1Update(context, &
c, 1);
253 while ((context->count[0] & 504) != 448) {
255 SHA1Update(context, &
c, 1);
257 SHA1Update(context, finalcount, 8);
258 for (
i = 0;
i < 20;
i++) {
259 digest[
i] = (
unsigned char)((context->state[
i >> 2] >> ((3 - (
i & 3)) * 8)) & 255);
262 memset(context,
'\0',
sizeof(*context));
263 memset(&finalcount,
'\0',
sizeof(finalcount));
275 for (ii = 0; ii <
len; ii += 1) {
276 SHA1Update(&ctx, (
const unsigned char*)
str + ii, 1);
278 SHA1Final((
unsigned char*)hash_out, &ctx);
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events d
#define SHA_R3(v, w, x, y, z, i)
#define SHA_R2(v, w, x, y, z, i)
#define SHA_R0(v, w, x, y, z, i)
#define SHA_R1(v, w, x, y, z, i)
#define SHA_R4(v, w, x, y, z, i)
GLboolean GLboolean GLboolean b
GLenum GLenum GLsizei len
GLboolean GLboolean GLboolean GLboolean a
const track::TrackFitContext< NLayers > const TrackFollowContext< NLayers > & ctx