udp over tcp

This commit is contained in:
breakwa11
2015-06-09 23:59:03 +08:00
parent e001f1818c
commit 62dca9d3cd
7 changed files with 516 additions and 22 deletions
+2
View File
@@ -47,6 +47,8 @@ def try_cipher(key, method=None):
def EVP_BytesToKey(password, key_len, iv_len):
# equivalent to OpenSSL's EVP_BytesToKey() with count 1
# so that we make the same key and iv as nodejs version
if hasattr(password, 'encode'):
password = password.encode('utf-8')
cached_key = '%s-%d-%d' % (password, key_len, iv_len)
r = cached_keys.get(cached_key, None)
if r: