@@ -79,12 +79,8 @@ def generate_single(k: dsa.DSAPrivateKey, id1: int, id2: int, hwid: str) -> str:
7979 return f .format (serial , id1 , id2 , sig )
8080
8181
82- def generate_all (k : dsa .DSAPrivateKey , hwid : str , version : int ) -> str :
83- ident = { 9 : 0x90 ,
84- 10 : 0xa0 ,
85- 11 : 0xb0 ,
86- 12 : 0xc0 }
87- yield generate_single (k , 0x0 , ident [version ], hwid )
82+ def generate_all (k : dsa .DSAPrivateKey , hwid : str , ver : int ) -> str :
83+ yield generate_single (k , 0x2 if ver >= 12 else 0x0 , ver << 4 , hwid )
8884 for i in range (0x40 , 0xff + 1 ):
8985 yield generate_single (k , i , 0x10 , hwid )
9086 for i in range (0x8000 , 0x80ff + 1 ):
@@ -101,7 +97,7 @@ def generate_all(k: dsa.DSAPrivateKey, hwid: str, version: int) -> str:
10197
10298hwid = args .hwid .upper ()
10399if len (hwid ) == 24 :
104- hwid = "-" .join (( hwid [: 4 ], hwid [ 4 : 8 ], hwid [ 8 : 12 ], hwid [ 12 : 16 ], hwid [ 16 : 20 ], hwid [ 20 :] ))
100+ hwid = "-" .join (hwid [i : i + 4 ] for i in range ( 0 , 24 , 4 ))
105101assert re .fullmatch (r"([0-9A-F]{4}-){5}[0-9A-F]{4}" , hwid ), f"Expected hardware ID like 1111-1111-1111-1111-1111-1111, not { hwid } "
106102
107103lines = generate_all (team_r2r_key , hwid , args .version )
0 commit comments