~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/chat.py

  • Committer: Matt Giuca
  • Date: 2010-02-12 10:27:55 UTC
  • Revision ID: matt.giuca@gmail.com-20100212102755-ifsyo4qaqa2myvl5
docs: Added a new help page, Running and Serving.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
import cjson
23
23
import cStringIO
24
 
import md5
 
24
import hashlib
25
25
import sys
26
26
import os
27
27
import socket
97
97
            env = cjson.decode(inp)
98
98
            
99
99
            # Check that the message is 
100
 
            digest = md5.new(env['content'] + magic).digest().encode('hex')
 
100
            digest = hashlib.md5(env['content'] + magic).hexdigest()
101
101
            if env['digest'] != digest:
102
102
                conn.close()
103
103
                continue
134
134
    sok = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
135
135
    sok.connect((host, port))
136
136
    content = cjson.encode(msg)
137
 
    digest = md5.new(content + magic).digest().encode("hex")
 
137
    digest = hashlib.md5(content + magic).hexdigest()
138
138
    env = {'digest':digest,'content':content}
139
139
    sok.send(cjson.encode(env))
140
140