-
+typedef __uint64_t mylong;
typedef unsigned char uchar;
}
-ulong xorseed;
+mylong xorseed;
-ulong xorshift64()
+mylong xorshift64()
{
/* Algorithm "xor" from p. 4 of Marsaglia, "Xorshift RNGs" */
- ulong x = xorseed;
+ mylong x = xorseed;
x ^= x >> 12; // a
x ^= x << 25; // b
x ^= x >> 27; // c
template<int h>
-void encrypt_ecb_prng(uchar* seq_in, uchar *seq_out, int len,uchar* RM, int *Pbox, int *PboxSRM, uchar *Sbox1, uchar *Sbox2, ulong myrand, int debug) {
+void encrypt_ecb_prng(uchar* seq_in, uchar *seq_out, int len,uchar* RM, int *Pbox, int *PboxSRM, uchar *Sbox1, uchar *Sbox2, mylong myrand, int debug) {
uchar X[h];
uchar Y[h];
uchar fX[h];
uchar gY[h];
- uchar RM1[h];
- uchar RM2[h];
+ uchar *RM1=&RM[0];
+ uchar *RM2=&RM[h];
uchar tmp[h];
- ulong *rm1=(ulong*)RM1;
- ulong *rm2=(ulong*)RM2;
+ mylong *rm1=(mylong*)RM1;
+ mylong *rm2=(mylong*)RM2;
+
+
for(int it=0;it<len/2;it++) {
int ind1=Pbox[it]*h;
template<int h>
-void decrypt_ecb_prng(uchar* seq_in, uchar *seq_out, int len, uchar* RM, int *Pbox, int *PboxSRM, uchar *Sbox1, uchar *Sbox2, uchar *Inv_Sbox1, uchar *Inv_Sbox2, ulong myrand, int debug) {
+void decrypt_ecb_prng(uchar* seq_in, uchar *seq_out, int len, uchar* RM, int *Pbox, int *PboxSRM, uchar *Sbox1, uchar *Sbox2, uchar *Inv_Sbox1, uchar *Inv_Sbox2, mylong myrand, int debug) {
uchar invfX[h];
uchar invgY[h];
uchar RM1[h];
uchar RM2[h];
uchar tmp[h];
- ulong *rm1=(ulong*)RM1;
- ulong *rm2=(ulong*)RM2;
+ mylong *rm1=(mylong*)RM1;
+ mylong *rm2=(mylong*)RM2;
+
for(int it=0;it<len/2;it++) {
int ind1=Pbox[it]*h;
template<int h>
-void encrypt_ecb_rm(uchar* seq_in, uchar *seq_out, int len,uchar* RM, int *Pbox, int *PboxSRM, uchar *Sbox1, uchar *Sbox2, ulong myrand, int debug) {
+void encrypt_ecb_rm(uchar* seq_in, uchar *seq_out, int len,uchar* RM, int *Pbox, int *PboxSRM, uchar *Sbox1, uchar *Sbox2, mylong myrand, int debug) {
uchar X[h];
uchar Y[h];
uchar RM1[h];
uchar RM2[h];
uchar tmp[h];
- ulong *rm1=(ulong*)RM1;
- ulong *rm2=(ulong*)RM2;
+ mylong *rm1=(mylong*)RM1;
+ mylong *rm2=(mylong*)RM2;
for(int it=0;it<len/2;it++) {
int ind1=Pbox[it]*h;
template<int h>
-void decrypt_ecb_rm(uchar* seq_in, uchar *seq_out, int len, uchar* RM, int *Pbox, int *PboxSRM, uchar *Sbox1, uchar *Sbox2, uchar *Inv_Sbox1, uchar *Inv_Sbox2, ulong myrand, int debug) {
+void decrypt_ecb_rm(uchar* seq_in, uchar *seq_out, int len, uchar* RM, int *Pbox, int *PboxSRM, uchar *Sbox1, uchar *Sbox2, uchar *Inv_Sbox1, uchar *Inv_Sbox2, mylong myrand, int debug) {
uchar invfX[h];
uchar invgY[h];
uchar RM1[h];
uchar RM2[h];
uchar tmp[h];
- ulong *rm1=(ulong*)RM1;
- ulong *rm2=(ulong*)RM2;
+ mylong *rm1=(mylong*)RM1;
+ mylong *rm2=(mylong*)RM2;
for(int it=0;it<len/2;it++) {
int ind1=Pbox[it]*h;
uchar *RM1=&RM[0];
uchar *RM2=&RM[h];
uchar tmp[h];
- ulong *rm1=(ulong*)RM1;
- ulong *rm2=(ulong*)RM2;
+ mylong *rm1=(mylong*)RM1;
+ mylong *rm2=(mylong*)RM2;
// uchar RM1[h];
// uchar RM2[h];
uchar tmp[h];
- ulong *rm1=(ulong*)RM1;
- ulong *rm2=(ulong*)RM2;
+ mylong *rm1=(mylong*)RM1;
+ mylong *rm2=(mylong*)RM2;
for(int it=0;it<len/2;it++) {
int ind1=Pbox[it]*h;
uchar RM[h*h*2+256];
uchar IV[2*h];
- ulong myrand=0;
-
+ mylong myrand=0;
+
double time_encrypt=0;
double time_decrypt=0;
}
-
return 0;
}