e uscita ora solo da compilare. sul sito originale.
alla faccia di tutti quelli che volevano fottere
festegiamo ragazzi
// SIFTEAM funzione per cambio endianness
37 ////// special thanks to an "italian forum" !!!!
38
39 void postprocess_cw(ECM_REQUEST *er, int posECMbody)
40 {
41 #if __BYTE_ORDER == __BIG_ENDIAN
42 static unsigned char Tb1[0xC]={0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF,0xF8,0x61,0xCB,0x52};
43 static unsigned char Tb2[0x40]= {
44 0xC5,0x39,0xF5,0xB9,0x90,0x99,0x01,0x3A,0xD4,0xB9,0x6A,0xB5,0xEA,0x67,0x7E,0xB4,
45 0x6C,0x30,0x4B,0xF0,0xB8,0x10,0xB0,0xB5,0xB7,0x6D,0xA7,0x51,0x1A,0xE7,0x14,0xCA,
46 0x4F,0x4F,0x15,0x86,0x26,0x08,0x10,0xB1,0xE7,0xE1,0x48,0xBE,0x7D,0xDD,0x5E,0xCB,
47 0xcF,0xBF,0x32,0x3B,0x8B,0x31,0xB1,0x31,0x0F,0x1A,0x66,0x4B,0x01,0x40,0x01,0x00
48 };
49 #else
50 static unsigned char Tb1[0xC]={0x23,0x01,0x67,0x45,0xAB,0x89,0xEF,0xCD,0x61,0xF8,0x52,0xCB};
51 static unsigned char Tb2[0x40]= {
52 0x39,0xC5,0xB9,0xF5,0x99,0x90,0x3A,0x01,0xB9,0xD4,0xB5,0x6A,0x67,0xEA,0xB4,0x7E,
53 0x30,0x6C,0xF0,0x4B,0x10,0xB8,0xB5,0xB0,0x6D,0xB7,0x51,0xA7,0xE7,0x1A,0xCA,0x14,
54 0x4F,0x4F,0x86,0x15,0x08,0x26,0xB1,0x10,0xE1,0xE7,0xBE,0x48,0xDD,0x7D,0xCB,0x5E,
55 0xBF,0xCF,0x3B,0x32,0x31,0x8B,0x31,0xB1,0x1A,0x0F,0x4B,0x66,0x40,0x01,0x00,0x01
56 };
57 #endif
58 unsigned char tabletmp2[0x10] = {0x0B,0x04,0x07,0x08,0x05,0x09,0x0B,0x0A,0x07,0x02,0x0A,0x05,0x04,0x08,0x0D,0x0F};
59 unsigned char table40[0x40];
60 unsigned char Hash48[0x48];
61 unsigned char Hash14[0x14];
62 unsigned char counter=0,counter2=0;
63 int tmp1;
64 int a,b,h,j,k,l,m = 0;
65 int i;
66 int posB0 = -1;
67 for (i = 6; i < posECMbody; i++)
68 {
69 if (er->ecm == 0xB0)
70 {
71 posB0 = i;
72 break;
73 }
74 }
75 if (posB0 == -1) return;
76
77 //b= (er->ecm[0]&1) * 8;
78 for (b=0 ; b<=8; b+=8) {
79 memset(Hash48,0,0x48);
80 Hash48[0] = er->cw[b + 0];
81 Hash48[1] = er->cw[b + 1];
82 Hash48[2] = er->cw[b + 2];
83 Hash48[3] = er->cw[b + 3];
84 Hash48[4] = er->cw[b + 4];
85 Hash48[5] = er->cw[b + 5];
86 Hash48[6] = er->cw[b + 6];
87 Hash48[7] = er->cw[b + 7];
88 Hash48[8]=0x80;
89 //for(a=9;a<0x48;a++)
90 // Hash48[a]=0;
91 //table40=(unsigned char*)malloc(0x40);
92 memcpy(table40,Tb2,0x40);
93
94 for(i = 0; i < 12; i++) Hash14 = Tb1;
95
96 int k1 = *((short*) &Hash14); int k2 = *((short*) &Hash14+1); int k3 = *((short*) &Hash14+2);
97 int k4 = *((short*) &Hash14+3); int k5 = *((short*) &Hash14+4); int k6 = *((short*) &Hash14+5);
98 for (m = 0; m < 2; m++) {
99 int loop;
100 for (loop = 0; loop < 0x24; loop++) {
101 h=((Hash48[(loop<<1) +1]<<8)+Hash48[loop<<1])&0xFFFF;
102 if(m)
103 tmp1 = (((k2 & k4) | ((~k4) & k3)) & 0xFFFF);
104 else
105 tmp1 = (((k2 & k3) | ((~k2) & k4)) & 0xFFFF);
106 if((counter & 1))
107 k = *(((short *) table40)+(counter>>1))>>8;
108 else
109 k = *(((short *) table40)+(counter>>1));
110 l = k1; j = k2;
111 k1 = k2; k2 = k3; k3 = k4; k4 = k5; k5 = k6;
112 k6 = ((tmp1 + l + h + (k & 0xFF)) & 0xFFFF);
113 tmp1 = tabletmp2[counter2];
114 k6 = ((((k6 << tmp1) | (k6 >> (0x10 - tmp1))) + j) & 0xFFFF);
115 counter2++;
116 if(counter2 == 0x10) counter2 = 0;
117 counter++;
118 if(counter == 0x40) counter = 0;
119 }
120 //free(table40);
121 }
122
123 #if __BYTE_ORDER == __BIG_ENDIAN
124 er->cw[b + 0] = (k1 + *((short *)&Hash14)) & 0xFF;
125 er->cw[b + 1] = (k1 + *((short *)&Hash14))>>8;
126 er->cw[b + 2] = (k2 + *((short *)&Hash14+1)) & 0xFF;
127 er->cw[b + 3] = (er->cw[b + 0] + er->cw[b + 1] + er->cw[b + 2]) & 0xFF;
128 er->cw[b + 4] = (k3 + *((short *)&Hash14+2)) & 0xFF;
129 er->cw[b + 5] = (k3 + *((short *)&Hash14+2))>>8;
130 er->cw[b + 6] = (k4 + *((short *)&Hash14+3)) & 0xFF;
131 er->cw[b + 7] = (er->cw[b + 4] + er->cw[b + 5] + er->cw[b + 6]) & 0xFF;
132 #else
133 er->cw[b + 0] = (k1 + *((short *)&Hash14))>>8;
134 er->cw[b + 1] = (k1 + *((short *)&Hash14)) & 0xFF;
135 er->cw[b + 2] = (k2 + *((short *)&Hash14+1))>>8;
136 er->cw[b + 3] = (er->cw[b + 0] + er->cw[b + 1] + er->cw[b + 2]) & 0xFF;
137 er->cw[b + 4] = (k3 + *((short *)&Hash14+2))>>8;
138 er->cw[b + 5] = (k3 + *((short *)&Hash14+2)) & 0xFF;
139 er->cw[b + 6] = (k4 + *((short *)&Hash14+3))>>8;
140 er->cw[b + 7] = (er->cw[b + 4] + er->cw[b + 5] + er->cw[b + 6]) & 0xFF;
141 #endif
142
143 cs_dump (er->cw+b, 8, "Postprocessed DW:");
144 }//end for b
145 }
146
147
148
149 ////// ====================================================================================
150
39 151 static void swap_lb (unsigned char *buff, int len)
40 152 {
… …
746 858 l = do_cmd(ins54,NULL,NULL);
747 859 if(l>0 && status_ok(cta_res+l)) {
860 postprocess_cw(er, posECMpart2);
748 861 if(er->ecm[0]&1) {
749 862 memcpy(er->cw+8,CW1,8);
alla faccia di tutti quelli che volevano fottere
festegiamo ragazzi
// SIFTEAM funzione per cambio endianness
37 ////// special thanks to an "italian forum" !!!!
38
39 void postprocess_cw(ECM_REQUEST *er, int posECMbody)
40 {
41 #if __BYTE_ORDER == __BIG_ENDIAN
42 static unsigned char Tb1[0xC]={0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF,0xF8,0x61,0xCB,0x52};
43 static unsigned char Tb2[0x40]= {
44 0xC5,0x39,0xF5,0xB9,0x90,0x99,0x01,0x3A,0xD4,0xB9,0x6A,0xB5,0xEA,0x67,0x7E,0xB4,
45 0x6C,0x30,0x4B,0xF0,0xB8,0x10,0xB0,0xB5,0xB7,0x6D,0xA7,0x51,0x1A,0xE7,0x14,0xCA,
46 0x4F,0x4F,0x15,0x86,0x26,0x08,0x10,0xB1,0xE7,0xE1,0x48,0xBE,0x7D,0xDD,0x5E,0xCB,
47 0xcF,0xBF,0x32,0x3B,0x8B,0x31,0xB1,0x31,0x0F,0x1A,0x66,0x4B,0x01,0x40,0x01,0x00
48 };
49 #else
50 static unsigned char Tb1[0xC]={0x23,0x01,0x67,0x45,0xAB,0x89,0xEF,0xCD,0x61,0xF8,0x52,0xCB};
51 static unsigned char Tb2[0x40]= {
52 0x39,0xC5,0xB9,0xF5,0x99,0x90,0x3A,0x01,0xB9,0xD4,0xB5,0x6A,0x67,0xEA,0xB4,0x7E,
53 0x30,0x6C,0xF0,0x4B,0x10,0xB8,0xB5,0xB0,0x6D,0xB7,0x51,0xA7,0xE7,0x1A,0xCA,0x14,
54 0x4F,0x4F,0x86,0x15,0x08,0x26,0xB1,0x10,0xE1,0xE7,0xBE,0x48,0xDD,0x7D,0xCB,0x5E,
55 0xBF,0xCF,0x3B,0x32,0x31,0x8B,0x31,0xB1,0x1A,0x0F,0x4B,0x66,0x40,0x01,0x00,0x01
56 };
57 #endif
58 unsigned char tabletmp2[0x10] = {0x0B,0x04,0x07,0x08,0x05,0x09,0x0B,0x0A,0x07,0x02,0x0A,0x05,0x04,0x08,0x0D,0x0F};
59 unsigned char table40[0x40];
60 unsigned char Hash48[0x48];
61 unsigned char Hash14[0x14];
62 unsigned char counter=0,counter2=0;
63 int tmp1;
64 int a,b,h,j,k,l,m = 0;
65 int i;
66 int posB0 = -1;
67 for (i = 6; i < posECMbody; i++)
68 {
69 if (er->ecm == 0xB0)
70 {
71 posB0 = i;
72 break;
73 }
74 }
75 if (posB0 == -1) return;
76
77 //b= (er->ecm[0]&1) * 8;
78 for (b=0 ; b<=8; b+=8) {
79 memset(Hash48,0,0x48);
80 Hash48[0] = er->cw[b + 0];
81 Hash48[1] = er->cw[b + 1];
82 Hash48[2] = er->cw[b + 2];
83 Hash48[3] = er->cw[b + 3];
84 Hash48[4] = er->cw[b + 4];
85 Hash48[5] = er->cw[b + 5];
86 Hash48[6] = er->cw[b + 6];
87 Hash48[7] = er->cw[b + 7];
88 Hash48[8]=0x80;
89 //for(a=9;a<0x48;a++)
90 // Hash48[a]=0;
91 //table40=(unsigned char*)malloc(0x40);
92 memcpy(table40,Tb2,0x40);
93
94 for(i = 0; i < 12; i++) Hash14 = Tb1;
95
96 int k1 = *((short*) &Hash14); int k2 = *((short*) &Hash14+1); int k3 = *((short*) &Hash14+2);
97 int k4 = *((short*) &Hash14+3); int k5 = *((short*) &Hash14+4); int k6 = *((short*) &Hash14+5);
98 for (m = 0; m < 2; m++) {
99 int loop;
100 for (loop = 0; loop < 0x24; loop++) {
101 h=((Hash48[(loop<<1) +1]<<8)+Hash48[loop<<1])&0xFFFF;
102 if(m)
103 tmp1 = (((k2 & k4) | ((~k4) & k3)) & 0xFFFF);
104 else
105 tmp1 = (((k2 & k3) | ((~k2) & k4)) & 0xFFFF);
106 if((counter & 1))
107 k = *(((short *) table40)+(counter>>1))>>8;
108 else
109 k = *(((short *) table40)+(counter>>1));
110 l = k1; j = k2;
111 k1 = k2; k2 = k3; k3 = k4; k4 = k5; k5 = k6;
112 k6 = ((tmp1 + l + h + (k & 0xFF)) & 0xFFFF);
113 tmp1 = tabletmp2[counter2];
114 k6 = ((((k6 << tmp1) | (k6 >> (0x10 - tmp1))) + j) & 0xFFFF);
115 counter2++;
116 if(counter2 == 0x10) counter2 = 0;
117 counter++;
118 if(counter == 0x40) counter = 0;
119 }
120 //free(table40);
121 }
122
123 #if __BYTE_ORDER == __BIG_ENDIAN
124 er->cw[b + 0] = (k1 + *((short *)&Hash14)) & 0xFF;
125 er->cw[b + 1] = (k1 + *((short *)&Hash14))>>8;
126 er->cw[b + 2] = (k2 + *((short *)&Hash14+1)) & 0xFF;
127 er->cw[b + 3] = (er->cw[b + 0] + er->cw[b + 1] + er->cw[b + 2]) & 0xFF;
128 er->cw[b + 4] = (k3 + *((short *)&Hash14+2)) & 0xFF;
129 er->cw[b + 5] = (k3 + *((short *)&Hash14+2))>>8;
130 er->cw[b + 6] = (k4 + *((short *)&Hash14+3)) & 0xFF;
131 er->cw[b + 7] = (er->cw[b + 4] + er->cw[b + 5] + er->cw[b + 6]) & 0xFF;
132 #else
133 er->cw[b + 0] = (k1 + *((short *)&Hash14))>>8;
134 er->cw[b + 1] = (k1 + *((short *)&Hash14)) & 0xFF;
135 er->cw[b + 2] = (k2 + *((short *)&Hash14+1))>>8;
136 er->cw[b + 3] = (er->cw[b + 0] + er->cw[b + 1] + er->cw[b + 2]) & 0xFF;
137 er->cw[b + 4] = (k3 + *((short *)&Hash14+2))>>8;
138 er->cw[b + 5] = (k3 + *((short *)&Hash14+2)) & 0xFF;
139 er->cw[b + 6] = (k4 + *((short *)&Hash14+3))>>8;
140 er->cw[b + 7] = (er->cw[b + 4] + er->cw[b + 5] + er->cw[b + 6]) & 0xFF;
141 #endif
142
143 cs_dump (er->cw+b, 8, "Postprocessed DW:");
144 }//end for b
145 }
146
147
148
149 ////// ====================================================================================
150
39 151 static void swap_lb (unsigned char *buff, int len)
40 152 {
… …
746 858 l = do_cmd(ins54,NULL,NULL);
747 859 if(l>0 && status_ok(cta_res+l)) {
860 postprocess_cw(er, posECMpart2);
748 861 if(er->ecm[0]&1) {
749 862 memcpy(er->cw+8,CW1,8);