X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/blobdiff_plain/a0adebcd963a2cdfa2f0100cdadf882cb993cfbe..6b6283030645bb6d794289f860f73883a1cac83e:/OneRoundIoT/NEW/scprng.cpp?ds=inline diff --git a/OneRoundIoT/NEW/scprng.cpp b/OneRoundIoT/NEW/scprng.cpp index 83765d1..98e27c6 100644 --- a/OneRoundIoT/NEW/scprng.cpp +++ b/OneRoundIoT/NEW/scprng.cpp @@ -2,7 +2,7 @@ #include #include #include - +#include typedef unsigned char uchar; @@ -192,23 +192,35 @@ void rc4keyperm(uchar *key,int len, int rp,int *sc, int size_DK) { } } +#define ROR64(x,r) (((x)>>(r))|((x)<<(64-(r)))) +#define ROL64(x,r) (((x)<<(r))|((x)>>(64-(r)))) +#define R(x,y,k) (x=ROR64(x,18), x+=y, x^=k, y=ROL64(y,13), y^=x) -void scprng(uint64_t *plain, uint64_t* cipher, int bufsize, int nb_bloc, uint64_t *Val, uchar *Sbox1, uchar *Sbox2, int *Pbox, int *Pbox2, uchar *DK, int delta) { - int update=0; - for(int nb=0;nb