1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
diff -Naur pymsnt-0.11.3/src/avatar.py pymsnt-0.11.3-1/src/avatar.py
--- pymsnt-0.11.3/src/avatar.py 2008-02-08 14:55:07.000000000 +0100
+++ pymsnt-0.11.3-1/src/avatar.py 2011-09-04 13:40:02.350321866 +0200
@@ -6,7 +6,12 @@
from twisted.internet import reactor
from twisted.words.xish.domish import Element
-import sha, base64, os, os.path
+import base64, os, os.path
+
+try:
+ from hashlib import sha1
+except ImportError:
+ from sha import sha as sha1
import utils
import config
@@ -34,7 +39,7 @@
class Avatar:
""" Represents an Avatar. Does not store the image in memory. """
def __init__(self, imageData, avatarCache):
- self.__imageHash = sha.sha(imageData).hexdigest()
+ self.__imageHash = sha1(imageData).hexdigest()
self.__avatarCache = avatarCache
def getImageHash(self):
diff -Naur pymsnt-0.11.3/src/legacy/msn/msnp11chl.py pymsnt-0.11.3-1/src/legacy/msn/msnp11chl.py
--- pymsnt-0.11.3/src/legacy/msn/msnp11chl.py 2008-02-08 14:55:07.000000000 +0100
+++ pymsnt-0.11.3-1/src/legacy/msn/msnp11chl.py 2011-09-04 13:40:02.351321854 +0200
@@ -1,16 +1,20 @@
# Copyright 2005 James Bunton <james@delx.cjb.net>
# Licensed for distribution under the GPL version 2, check COPYING for details
-import md5
import struct
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5
+
MSNP11_PRODUCT_ID = "PROD0090YUAUV{2B"
MSNP11_PRODUCT_KEY = "YMM8C_H7KCQ2S_KL"
MSNP11_MAGIC_NUM = 0x0E79A9C1
def doChallenge(chlData):
- md5digest = md5.md5(chlData + MSNP11_PRODUCT_KEY).digest()
+ md5digest = md5(chlData + MSNP11_PRODUCT_KEY).digest()
# Make array of md5 string ints
md5Ints = struct.unpack("<llll", md5digest)
diff -Naur pymsnt-0.11.3/src/legacy/msn/msn.py pymsnt-0.11.3-1/src/legacy/msn/msn.py
--- pymsnt-0.11.3/src/legacy/msn/msn.py 2008-02-08 14:55:07.000000000 +0100
+++ pymsnt-0.11.3-1/src/legacy/msn/msn.py 2011-09-04 13:40:02.351321854 +0200
@@ -106,9 +106,12 @@
# System imports
-import types, operator, os, sys, base64, random, struct, random, sha, base64, StringIO, array, codecs, binascii
+import types, operator, os, sys, base64, random, struct, random, base64, StringIO, array, codecs, binascii
from urllib import quote, unquote
-
+try:
+ from hashlib import sha1
+except ImportError:
+ from sha import sha as sha1
MSN_PROTOCOL_VERSION = "MSNP11 CVR0" # protocol version
MSN_PORT = 1863 # default dispatch server port
@@ -490,7 +493,7 @@
self.type = 3
self.location = "TMP" + str(random.randint(1000,9999))
self.friendly = "AAA="
- self.sha1d = b64enc(sha.sha(imageData).digest())
+ self.sha1d = b64enc(sha1(imageData).digest())
self.makeText()
def setNull(self):
@@ -518,7 +521,7 @@
h.append(self.friendly)
h.append("SHA1D")
h.append(self.sha1d)
- sha1c = b64enc(sha.sha("".join(h)).digest())
+ sha1c = b64enc(sha1("".join(h)).digest())
self.text = '<msnobj Creator="%s" Size="%s" Type="%s" Location="%s" Friendly="%s" SHA1D="%s" SHA1C="%s"/>' % (self.creator, str(self.size), str(self.type), self.location, self.friendly, self.sha1d, sha1c)
def parse(self, s):
diff -Naur pymsnt-0.11.3/src/utils.py pymsnt-0.11.3-1/src/utils.py
--- pymsnt-0.11.3/src/utils.py 2008-02-08 14:55:07.000000000 +0100
+++ pymsnt-0.11.3-1/src/utils.py 2011-09-04 13:40:02.351321854 +0200
@@ -1,17 +1,17 @@
# Copyright 2004-2005 James Bunton <james@delx.cjb.net>
# Licensed for distribution under the GPL version 2, check COPYING for details
+try:
+ from hashlib import sha1
+except ImportError:
+ from sha import sha as sha1
+def socks5Hash(sid, initiator, target):
+ return sha1("%s%s%s" % (sid, initiator, target)).hexdigest()
def getLang(el):
return el.getAttribute((u'http://www.w3.org/XML/1998/namespace', u'lang'))
-
-import sha
-def socks5Hash(sid, initiator, target):
- return sha.new("%s%s%s" % (sid, initiator, target)).hexdigest()
-
-
import urllib
import os.path
def getURLBits(url, assumedType=None):
diff -Naur pymsnt-0.11.3/src/xdb.py pymsnt-0.11.3-1/src/xdb.py
--- pymsnt-0.11.3/src/xdb.py 2008-02-08 14:55:07.000000000 +0100
+++ pymsnt-0.11.3-1/src/xdb.py 2011-09-04 13:40:02.351321854 +0200
@@ -6,9 +6,13 @@
import os
import os.path
import shutil
-import md5
import config
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5
+
X = os.path.sep
SPOOL_UMASK = 0077
@@ -23,7 +27,7 @@
return file.replace("@", "%")
def makeHash(file):
- return md5.md5(file).hexdigest()[0:3]
+ return md5(file).hexdigest()[0:3]
class XDB:
|