From bfbe20e4226f5f38b3f64aad5fb84cfcafba6810 Mon Sep 17 00:00:00 2001 From: clowwindy Date: Tue, 21 May 2013 15:42:32 +0800 Subject: [PATCH] add PyCrypto --- local.py | 37 ++++++++++++++++--------------------- server.py | 36 +++++++++++++++--------------------- 2 files changed, 31 insertions(+), 42 deletions(-) diff --git a/local.py b/local.py index edbd7e2..94b2d2a 100755 --- a/local.py +++ b/local.py @@ -26,10 +26,11 @@ if sys.version_info < (2, 6): import simplejson as json else: import json - + try: - import gevent, gevent.monkey - gevent.monkey.patch_all(dns=gevent.version_info[0]>=1) + import gevent + import gevent.monkey + gevent.monkey.patch_all(dns=gevent.version_info[0] >= 1) except ImportError: gevent = None print >>sys.stderr, 'warning: gevent not found, using threading instead' @@ -38,21 +39,11 @@ import socket import select import SocketServer import struct -import string -import hashlib import os import logging import getopt +import encrypt -def get_table(key): - m = hashlib.md5() - m.update(key) - s = m.digest() - (a, b) = struct.unpack('=1) + import gevent + import gevent.monkey + gevent.monkey.patch_all(dns=gevent.version_info[0] >= 1) except ImportError: gevent = None print >>sys.stderr, 'warning: gevent not found, using threading instead' @@ -38,21 +39,11 @@ import socket import select import SocketServer import struct -import string -import hashlib import os import logging import getopt +import encrypt -def get_table(key): - m = hashlib.md5() - m.update(key) - s = m.digest() - (a, b) = struct.unpack('