PEP8
This commit is contained in:
@ -37,9 +37,11 @@ def sha1_hmac(secret, data):
|
|||||||
def onetimeauth_verify(_hash, data, key):
|
def onetimeauth_verify(_hash, data, key):
|
||||||
return _hash == sha1_hmac(key, data)[:ONETIMEAUTH_BYTES]
|
return _hash == sha1_hmac(key, data)[:ONETIMEAUTH_BYTES]
|
||||||
|
|
||||||
|
|
||||||
def onetimeauth_gen(data, key):
|
def onetimeauth_gen(data, key):
|
||||||
return sha1_hmac(key, data)[:ONETIMEAUTH_BYTES]
|
return sha1_hmac(key, data)[:ONETIMEAUTH_BYTES]
|
||||||
|
|
||||||
|
|
||||||
def compat_ord(s):
|
def compat_ord(s):
|
||||||
if type(s) == int:
|
if type(s) == int:
|
||||||
return s
|
return s
|
||||||
|
@ -184,7 +184,7 @@ class UDPRelay(object):
|
|||||||
logging.warn('UDP one time auth header is too short')
|
logging.warn('UDP one time auth header is too short')
|
||||||
return
|
return
|
||||||
_hash = data[-ONETIMEAUTH_BYTES:]
|
_hash = data[-ONETIMEAUTH_BYTES:]
|
||||||
_data = data[header_length: -ONETIMEAUTH_BYTES]
|
_data = data[header_length: -ONETIMEAUTH_BYTES]
|
||||||
_key = self._encryptor.decipher_iv + self._encryptor.key
|
_key = self._encryptor.decipher_iv + self._encryptor.key
|
||||||
if onetimeauth_verify(_hash, _data, _key) is False:
|
if onetimeauth_verify(_hash, _data, _key) is False:
|
||||||
logging.warn('UDP one time auth fail')
|
logging.warn('UDP one time auth fail')
|
||||||
|
Reference in New Issue
Block a user