From: <Blu...@us...> - 2009-12-18 19:07:17
|
Revision: 324 http://virtplayground.svn.sourceforge.net/virtplayground/?rev=324&view=rev Author: BlueWolf_ Date: 2009-12-18 19:07:07 +0000 (Fri, 18 Dec 2009) Log Message: ----------- Uses hashlib.sha1 instead of md5 for the cids Modified Paths: -------------- trunk/server/core/parser.py trunk/server/core/server.py Modified: trunk/server/core/parser.py =================================================================== --- trunk/server/core/parser.py 2009-12-18 19:06:56 UTC (rev 323) +++ trunk/server/core/parser.py 2009-12-18 19:07:07 UTC (rev 324) @@ -15,7 +15,7 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -import rsa, sha +import rsa, hashlib class Parser(): def __init__(self, callback, server): @@ -60,8 +60,8 @@ # Decrypt the password pwd = rsa.decrypt(msg['pwd'], client['rsa']) - # Double sha, so one can not insert "raw" sha - pwd = sha.new(pwd).hexdigest() + # Double sha, so n one can insert a "raw" sha + pwd = hashlib.sha1(pwd).hexdigest() if msg['for'] == 'VP': Modified: trunk/server/core/server.py =================================================================== --- trunk/server/core/server.py 2009-12-18 19:06:56 UTC (rev 323) +++ trunk/server/core/server.py 2009-12-18 19:07:07 UTC (rev 324) @@ -15,7 +15,7 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -import simplejson, socket, threading, time, md5, random, sys +import simplejson, socket, threading, time, random, sys, hashlib from parser import Parser import rsa @@ -154,9 +154,9 @@ continue # Create unique client-id - cid = md5.new(addr[0] + str(addr[1])).hexdigest()[:8] + cid = hashlib.sha1(addr[0] + str(addr[1])).hexdigest()[:8] while cid in self.clients: - cid = md5.new(addr[0] + str(addr[1]) + + cid = hashlib.sha1(addr[0] + str(addr[1]) + str(random.random())).hexdigest()[:8] self.clients[cid] = { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |