// Goal: Calculate the hash value
// Output: RM (hash value)
-
-// uchar *X=new uchar[h2];
-// uchar *fX=new uchar[h2];
uchar X[h];
int ind1,ind2;
for(int it=0;it<len;it++) {
- //ind1=Pbox[it]*h;
- //ind2=Pbox[(it+len/2)]*h;
ind1=(it*h)>>3;
// Mix with dynamic RM
for(int a=0;a<(h>>3);a++) {
rm[a]=rm[a]^ss[ind1+a];
- sum+=rm[a];
+ sum^=rm[a];
}
rm[0]=xorshift64(sum);
for(int a=1;a<(h>>3);a++) {
- rm[a]^=xorshift64(rm[a-1]);
- //rm[a]^=splitmix64(rm[a-1]);
+ rm[a]=xorshift64(rm[a-1]);
+ //rm[a]=splitmix64(rm[a-1]);
}
if(change==1) {
seq[4]++;
+ seq[5]--;
}
if(change==2) {
seq[9]++;
+ seq[10]--;
}
printf("seq 4 %d\n",seq[4]);
x^= x << 17;
return x;
}
-uint xorshift32(const uint t)
-{
- /* Algorithm "xor" from p. 4 of Marsaglia, "Xorshift RNGs" */
- uint x = t;
- x ^= x << 13;
- x ^= x >> 17;
- x ^= x << 5;
- return x;
-}
+
static inline uint64_t splitmix64(uint64_t index) {
uint64_t z = (index + UINT64_C(0x9E3779B97F4A7C15));
// Goal: Calculate the hash value
// Output: RM (hash value)
-
-// uchar *X=new uchar[h2];
-// uchar *fX=new uchar[h2];
uchar X[h];
int ind1,ind2;
- uint32_t *rm=(uint32_t*)RM1;
- uint32_t *xx=(uint32_t*)X;
- uint32_t *ss=(uint32_t*)seq_in;
+ uint64_t *rm=(uint64_t*)RM1;
+ // uint64_t *xx=(uint64_t*)X;
+ uint64_t *ss=(uint64_t*)seq_in;
-
+ int a;
for(int it=0;it<len;it++) {
- //ind1=Pbox[it]*h;
- //ind2=Pbox[(it+len/2)]*h;
-
- ind1=it*h/4;
+ ind1=(it*h)>>3;
// Mix with dynamic RM
- uint64_t sum=0;
- /* for(int a=0;a<h;a+=4) {
- X[a]=RM1[a]^seq_in[ind1+a];
- X[a+1]=RM1[a+1]^seq_in[ind1+a+1];
- X[a+2]=RM1[a+2]^seq_in[ind1+a+2];
- X[a+3]=RM1[a+3]^seq_in[ind1+a+3];
- }
- */
-
-
- for(int a=0;a<h/4;a++) {
- xx[a]=rm[a]^ss[ind1+a];
- sum+=xx[a];
- }
-
-
-
-
- rm[0]=xorshift32(sum);
- for(int a=1;a<h/4;a++) {
- rm[a]^=xorshift32(rm[a-1]);
- }
-
-
+ rm[0]=rm[0]^ss[ind1];
+ rm[0]=xorshift64(rm[0] );
+ for(a=1;a<(h>>3);a++) {
+ rm[a]=rm[a]^ss[ind1+a];
+ rm[a]=xorshift64(rm[a] ^ rm[a-1]);
+ }
+ rm[0]=xorshift64(rm[a] ^ rm[0] );
}
if(change==1) {
seq[4]++;
+ seq[5]--;
}
if(change==2) {
seq[9]++;
+ seq[10]--;
}
printf("seq 4 %d\n",seq[4]);