From ca740c8c9bc9c6adccca69a9c2f1a4aa7e2e7258 Mon Sep 17 00:00:00 2001 From: AkaneAkaza Date: Thu, 9 Nov 2017 14:19:31 +0800 Subject: [PATCH] optimize --- shadowsocks/obfsplugin/auth_chain.py | 11 ++++++----- shadowsocks/tcprelay.py | 5 +++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/shadowsocks/obfsplugin/auth_chain.py b/shadowsocks/obfsplugin/auth_chain.py index 49bafdc..bed2ffa 100644 --- a/shadowsocks/obfsplugin/auth_chain.py +++ b/shadowsocks/obfsplugin/auth_chain.py @@ -87,19 +87,20 @@ class xorshift128plus(object): y = self.v1 self.v0 = y x ^= ((x & xorshift128plus.mov_mask) << 23) - x ^= (y ^ (x >> 17) ^ (y >> 26)) & xorshift128plus.max_int + x ^= (y ^ (x >> 17) ^ (y >> 26)) self.v1 = x return (x + y) & xorshift128plus.max_int def init_from_bin(self, bin): - bin += b'\0' * 16 + if len(bin) < 16: + bin += b'\0' * 16 self.v0 = struct.unpack(' 0: