g++ -o $@ $< -std=c++11 -O3 -lm -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -g -O3 -Wall -I/home/couturie/ajeter/jerasure/include /home/couturie/ajeter/jerasure/src/.libs/jerasure.o /home/couturie/ajeter/jerasure/src/.libs/galois.o -lgf_complete -fpermissive
ida_gf65: ida_gf65.cpp
- g++ -o $@ $< -std=c++11 -O3 -lm -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -g -O3 -Wall -I/home/couturie/ajeter/jerasure/include /home/couturie/ajeter/jerasure/src/.libs/jerasure.o /home/couturie/ajeter/jerasure/src/.libs/galois.o -lgf_complete -fpermissive
+ g++ -o $@ $< -std=c++11 -O3 -lm -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -g -O3 -Wall -I/home/couturie/ajeter/jerasure/include /home/couturie/ajeter/jerasure/src/.libs/jerasure.o /home/couturie/ajeter/jerasure/src/.libs/galois.o -lgf_complete -fpermissive -lpthread
clean:
rm test_mat2 ida ida_gf64
#include <string.h>
#include <algorithm> // std::random_shuffle
#include <vector> // std::vector
+#include <unistd.h>
+#include <thread>
+
+
extern "C" {
#include "jerasure.h"
}
using namespace std;
-string cloud[5]={"dropboxida1","googleida1","megaida1","onedriveida1","pcloudida1"};
+string cloud[5]={"dropboxida1","googleida1","onedriveida2","onedriveida1","pcloudida1"};
void display(mylong *mat, int r, int c) {
// display(matC,t,t);
-
+ thread th[n];
//Save trunks
for(int i=0;i<n;i++) {
stringstream ss;
ss <<"lena_"<<i<<".png";
string str = ss.str();
saveFile((uint8_t*)&matC[i*len], str.c_str(),len*sizeof(mylong));
- sendChunk( str,i);
+// sendChunk( str,i);
+ th[i] = thread(sendChunk,str, i);
}
+ for(int i=0;i<n;i++) {
+ th[i].join();
+ }
+/* cout<<"sleep begin"<<endl;
+ sleep(2);
+ cout<<"sleep end"<<endl;
+*/
+
mylong *matCs = malloc(sizeof(mylong)*t*len);
mylong *matGs = malloc(sizeof(mylong)*t*t);
std::cout << "random chunk" << std::endl;
int ind=0;
+
+
+
for(int ii=0;ii<t;ii++) {
-// for(int i=n-1;i>=t;i--) {
-// for(int i=0;i<n;i+=2) {
auto i=myvector[ii];
std::cout << myvector[i] << " ";
ss <<"lena_"<<i<<".png";
string str = ss.str();
- retrieveChunk(str,i);
+// retrieveChunk(str,i);
+ th[ii] = thread(retrieveChunk,str, i);
+ }
+
+
+ ind=0;
+
+ for(int ii=0;ii<t;ii++) {
+
+ auto i=myvector[ii];
+ std::cout << myvector[i] << " ";
+
+
+ stringstream ss;
+ ss <<"lena_"<<i<<".png";
+ string str = ss.str();
+ th[ii].join();
readFile((uint8_t*)&matCs[ind*len], str.c_str(),len*sizeof(mylong));
// display(&matCs[ind*len],1,1);
#include<string.h>
#include <fstream>
#include <sys/time.h>
+#include <glib.h>
+
/*#include <cryptopp/hex.h>
#include <cryptopp/sha.h>
uchar *data_R, *data_G, *data_B;
int imsize;
uchar *buffer;
+
+
+
+
if(lena==1) {
load_RGB_pixmap("lena.ppm", &width, &height, &data_R, &data_G, &data_B);
for (int i = 0; i < 256 ; i++) {
mix[i]=Secretkey[i]^counter[i];
+
}
+ gchar *sha512;
+
+ sha512 = g_compute_checksum_for_string(G_CHECKSUM_SHA512, (const char*) mix, 256);
+// g_print("%s\n", sha512);
+
+
+
+
+
+
+
// cout<<"hash "<<endl;
for (int i = 0; i < 64 ; i++) {
// DK[i]=digest[i];
- DK[i]=mix[i];
+ DK[i]=sha512[i];
}
-
+ g_free(sha512);
int *Pbox=new int[len];