#include #include #include #include int keysize=0; int ordered[256]; int reversed[256]; int streamout[256]; /*PRNG*/ int streambuddy() { int mixpad[256]; int slot_1,slot_2,slot_3,slot_4; int i; for(i=0;i<256;i++) { if(i==255){ /*WRAPAROUND CASE*/ slot_1 = ordered[0]; slot_2 = ordered[slot_1]; ordered[slot_1] = ordered[i]; ordered[i] = slot_2; slot_3 = reversed[0]; slot_4 = reversed[slot_3]; reversed[slot_3] = reversed[i]; reversed[i] = slot_4; } else { slot_1 = ordered[i+1]; slot_2 = ordered[slot_1]; ordered[slot_1] = ordered[i]; ordered[i] = slot_2; slot_3 = reversed[i+1]; slot_4 = reversed[slot_3]; reversed[slot_3] = reversed[i]; reversed[i] = slot_4; } } for(i=0;i<256;i++) { mixpad[i] = reversed[i] ^ ordered[i]; } for(i=0;i<256;i++) { streamout[i] ^= mixpad[i]; } return 0; } /*KEYXPAND*/ int keyexpander(int key[], int keysize) { int serie[256]; int i=0,j=0,k=0; int stop=0; int found=0; for(i=0;i<256;i++) { stop=0; while(!stop) { found = 0; for(k=0;k 255) { key[j]=0; } } j++; if(j > keysize-1) {j=0;} } for(k=0;k<42;k++) { for(i=0;i<255;i++) { int slot_1,slot_2; slot_1 = serie[i+1]; slot_2 = serie[slot_1]; serie[slot_1] = serie[i]; serie[i] = slot_2; } } for(i=0;i<256;i++) { ordered[i]=serie[i]; } return 0; } int ireverse() { int i;int j=0;int slot1;int slot2; for(i=255;i>-1;i--) { reversed[j] = ordered[i]; j++; } /*A mechanism to make the reversed block out of phase*/ for(i=0;i<7;i++){ slot1 = reversed[i+1]; slot2 = reversed[slot1]; reversed[slot1] = reversed[i]; reversed[i] = slot2; } return 0; } int saltIV(int keyread[]){ int i; srand(clock()); for (i=0;i<4;i++){ keyread[i]=rand()%256; } return 0; } int IDkeyfix(int keyread[]){ int s,r,j,k; int sum=128; int dup; r=keysize; for(k=0;kIV+PASSWORD*/ // saltIV(keyread); keysize = strlen(Keyword); for (i=0; i " >> keysearch.result.txt; ./streambody_new_keysearch $cc 16 >> keysearch.result.txt; echo "" >> keysearch.result.txt; done rm keysearch.result.txt; c="abcdefghijklmnopqrstuvwxyz"; for ((i=0; i<${#c}; i++)); do cc="baaaaaaaaaaaabab${c:i:1}"; echo -en "$cc => " >> keysearch.result.txt; ./streambody_new_keysearch $cc 16 >> keysearch.result.txt; echo "" >> keysearch.result.txt; done rm keysearch.result.txt; c="abcdefghijklmnopqrstuvwxyz"; for ((i=0; i<${#c}; i++)); do cc="bje8erh:98#_bab${c:i:1}"; echo -en "$cc => " >> keysearch.result.txt; ./streambody_new_keysearch $cc 16 >> keysearch.result.txt; echo "" >> keysearch.result.txt; done */