X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/blobdiff_plain/5dc05da2f861c83c65edbcc78681b54d01753bd9..8d1fcf81c437856befb3c4d31fcb6afce6a8f6ca:/OneRoundIoT/EnhancedOneRound/enhanced_oneround.cpp?ds=sidebyside 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