From 8d1fcf81c437856befb3c4d31fcb6afce6a8f6ca Mon Sep 17 00:00:00 2001 From: couturie Date: Fri, 7 Dec 2018 09:01:24 +0100 Subject: [PATCH 1/1] new --- .../EnhancedOneRound/enhanced_oneround.cpp | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/OneRoundIoT/EnhancedOneRound/enhanced_oneround.cpp b/OneRoundIoT/EnhancedOneRound/enhanced_oneround.cpp index 5842b5f..1b2980c 100644 --- a/OneRoundIoT/EnhancedOneRound/enhanced_oneround.cpp +++ b/OneRoundIoT/EnhancedOneRound/enhanced_oneround.cpp @@ -38,7 +38,7 @@ int ecbprng=0; -typedef __uint64_t ulong; +typedef __uint64_t mylong; typedef unsigned char uchar; @@ -74,12 +74,12 @@ uint xorshift32(const uint t) } -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 @@ -191,7 +191,7 @@ void prga(uchar *sc, int ldata, uchar *r) { template -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]; @@ -200,8 +200,8 @@ void encrypt_ecb_prng(uchar* seq_in, uchar *seq_out, int len,uchar* RM, int *Pbo 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; @@ -319,7 +319,7 @@ void encrypt_ecb_prng(uchar* seq_in, uchar *seq_out, int len,uchar* RM, int *Pbo template -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]; @@ -328,8 +328,8 @@ void decrypt_ecb_prng(uchar* seq_in, uchar *seq_out, int len, uchar* RM, int *Pb 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 -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]; @@ -455,8 +455,8 @@ void encrypt_ecb_rm(uchar* seq_in, uchar *seq_out, int len,uchar* RM, int *Pbox, 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 -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]; @@ -581,8 +581,8 @@ void decrypt_ecb_rm(uchar* seq_in, uchar *seq_out, int len, uchar* RM, int *Pbox 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