@@ -90,24 +90,24 @@ AREA calculate0(const unsigned char *UID,const int cardType){
9090 return temp ;
9191}
9292AREA calculate8 (const unsigned char * UID ,int num ,int ifHalf ,unsigned char times ) {
93- unsigned char c /*sorry this line can't be made public*/ ;
94- unsigned char b /*sorry this line can't be made public*/ ;
95- unsigned char a /*sorry this line can't be made public*/ ;
96- unsigned char d /*sorry this line can't be made public*/ ;
97- unsigned char e /*sorry this line can't be made public*/ ;
98- unsigned char A /*sorry this line can't be made public*/ ;
99- unsigned char B /*sorry this line can't be made public*/ ;
100- unsigned char C /*sorry this line can't be made public*/ ;
101- unsigned char D /*sorry this line can't be made public*/ ;
102- unsigned char E /*sorry this line can't be made public*/ ;
103- unsigned char F /*sorry this line can't be made public*/ ;
104- unsigned char keys [6 ]= {A ,B ,C ,D ,E ,F };
93+ const unsigned char c = ifHalf * 5 ;
94+ const unsigned char b = num / 256 ;
95+ const unsigned char a = num % 256 ;
96+ const unsigned char d = a + b + c + times ;
97+ const unsigned char e = UID [ 0 ] + UID [ 1 ] + UID [ 2 ] + 0x01 ;
98+ const unsigned char A = UID [ 0 ] - 0x3d ;
99+ const unsigned char B = UID [ 1 ] - 0x0f ;
100+ const unsigned char C = UID [ 2 ]| 0x39 ;
101+ const unsigned char D = ( UID [ 3 ] - 0xdb )^ 0x29 ;
102+ const unsigned char E = ( UID [ 0 ] + 0x11 )^ 0x65 ;
103+ const unsigned char F = ( UID [ 3 ] + 0x30 ) & 0x77 ;
104+ const unsigned char keys [6 ]= {A ,B ,C ,D ,E ,F };
105105 BLOCK water_data = {0 },check = {0 },key = {0 };
106- AREA ret_area ;
107- check .data [0 ]/*sorry this line can't be made public*/ ;
108- check .data [1 ]/*sorry this line can't be made public*/ ;
109- check .data [2 ]/*sorry this line can't be made public*/ ;
110- check .data [3 ]/*sorry this line can't be made public*/ ;
106+ const AREA ret_area ;
107+ check .data [0 ]= UID [ 0 ] ;
108+ check .data [1 ]= UID [ 1 ] ;
109+ check .data [2 ]= UID [ 2 ] ;
110+ check .data [3 ]= 0x01 ;
111111 check .data [15 ]= e ;
112112 water_data .data [0 ]= a ;
113113 water_data .data [1 ]= b ;
@@ -119,9 +119,9 @@ AREA calculate8(const unsigned char *UID,int num,int ifHalf,unsigned char times)
119119 key .data [8 ]= 0x80 ;
120120 key .data [9 ]= 0x69 ;
121121 for (int i = 0 ; i < 6 ; ++ i ) {key .data [i ] = keys [i ];key .data [i + 10 ] = keys [i ];}
122- //sorry this line can't be made public
123- //sorry this line can't be made public
124- //sorry this line can't be made public
125- //sorry this line can't be made public
122+ memcpy ( & ( ret_area . blocks [ 0 ]), & check , sizeof ( BLOCK ));
123+ memcpy ( & ( ret_area . blocks [ 1 ]), & water_data , sizeof ( BLOCK ));
124+ memcpy ( & ( ret_area . blocks [ 2 ]), & water_data , sizeof ( BLOCK ));
125+ memcpy ( & ( ret_area . blocks [ 3 ]), & key , sizeof ( BLOCK ));
126126 return ret_area ;
127127};
0 commit comments