From 99cd2d5c315169175fb088a725a3e769332516d8 Mon Sep 17 00:00:00 2001 From: AkaneAkaza Date: Wed, 8 Nov 2017 15:46:11 +0800 Subject: [PATCH] auth_chain_f sync from client time --- shadowsocks/obfsplugin/auth_chain.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/shadowsocks/obfsplugin/auth_chain.py b/shadowsocks/obfsplugin/auth_chain.py index 2860655..49bafdc 100644 --- a/shadowsocks/obfsplugin/auth_chain.py +++ b/shadowsocks/obfsplugin/auth_chain.py @@ -414,6 +414,9 @@ class auth_chain_a(auth_base): self.server_info.data.local_client_id, struct.pack('> (8 * i)) & 0xFF) - self.server_info.data.set_max_client(max_client) self.init_data_size(self.server_info.key) def init_data_size(self, key): @@ -893,9 +899,13 @@ class auth_chain_f(auth_chain_e): random = xorshift128plus() # key xor with key_change_datetime_key new_key = bytearray(key) + new_key_str = '' for i in range(0, 8): new_key[i] ^= self.key_change_datetime_key_bytes[i] - random.init_from_bin(new_key) + new_key_str += chr(new_key[i]) + for i in range(8, len(new_key)): + new_key_str += chr(new_key[i]) + random.init_from_bin(to_bytes(new_key_str)) # 补全数组长为12~24-1 list_len = random.next() % (8 + 16) + (4 + 8) for i in range(0, list_len):