summaryrefslogtreecommitdiff
blob: 671b994b3a2f907b34c96fdf24cf393bd795d191 (plain)
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
# Description: Fix python2.6 deprecation warnings
# Origin: Ubuntu
# Author: Alessio Treglia <quadrispro@ubuntu.com>
# Bug-Ubuntu: https://bugs.launchpad.net/bugs/394775
diff -Nur -x '*.orig' -x '*~' pyzor-0.5.0/lib/pyzor/client.py pyzor-0.5.0.new/lib/pyzor/client.py
--- pyzor-0.5.0/lib/pyzor/client.py	2009-04-29 22:53:50.000000000 +0200
+++ pyzor-0.5.0.new/lib/pyzor/client.py	2009-08-01 12:27:55.749263645 +0200
@@ -10,7 +10,7 @@
 import tempfile
 import mimetools
 import multifile
-import sha
+import hashlib
 
 import pyzor
 from pyzor import *
@@ -402,12 +402,12 @@
         del p2
 
         saltfile = open(randfile)
-        salt = saltfile.read(sha.digest_size)
+        salt = saltfile.read(hashlib.sha1().digest_size)
         del saltfile
 
-        salt_digest = sha.new(salt)
+        salt_digest = hashlib.sha1(salt)
 
-        pass_digest = sha.new()
+        pass_digest = hashlib.sha1()
         pass_digest.update(salt_digest.digest())
         pass_digest.update(p1)
         sys.stdout.write("salt,key:\n")
@@ -498,7 +498,7 @@
         if len(offsets) == 0:
             return
 
-        self._digest = sha.new()
+        self._digest = hashlib.sha1()
 
         if len(offsets) <= self.atomic_num_lines:
             self.handle_atomic(fp)
diff -Nur -x '*.orig' -x '*~' pyzor-0.5.0/lib/pyzor/__init__.py pyzor-0.5.0.new/lib/pyzor/__init__.py
--- pyzor-0.5.0/lib/pyzor/__init__.py	2009-04-29 22:53:50.000000000 +0200
+++ pyzor-0.5.0.new/lib/pyzor/__init__.py	2009-08-01 12:28:20.268413580 +0200
@@ -8,7 +8,7 @@
 import os.path
 import re
 import sys
-import sha
+import hashlib
 import tempfile
 import random
 import ConfigParser
@@ -114,7 +114,7 @@
 
 class DataDigest(str):
     # hex output doubles digest size
-    value_size = sha.digest_size * 2
+    value_size = hashlib.sha1().digest_size * 2
 
     def __init__(self, value):
         if len(value) != self.value_size:
@@ -285,7 +285,7 @@
         """returns a digest object"""
         typecheck(msg, Message)
 
-        return sha.new(str(msg))
+        return hashlib.sha1(str(msg))
 
     hash_msg = staticmethod(hash_msg)
 
@@ -295,7 +295,7 @@
         typecheck(key, long)
         typecheck(user, Username)
 
-        return sha.new("%s:%x" % (Username, key)).hexdigest().lower()
+        return hashlib.sha1("%s:%x" % (Username, key)).hexdigest().lower()
 
     hash_key = staticmethod(hash_key)
 
@@ -316,7 +316,7 @@
 
         h_msg = self.hash_msg(msg)
 
-        return sha.new("%s:%d:%s" % (h_msg.digest(), ts, hashed_key)).hexdigest().lower()
+        return hashlib.sha1("%s:%d:%s" % (h_msg.digest(), ts, hashed_key)).hexdigest().lower()
 
     sign_msg = classmethod(sign_msg)