Merge lp:~jpds/ubuntu-bots/remove-md5-usage into lp:~tsimpson/ubuntu-bots/tweak

Proposed by Jonathan Davies on 2010-01-30
Status: Merged
Merged at revision: 153
Proposed branch: lp:~jpds/ubuntu-bots/remove-md5-usage
Merge into: lp:~tsimpson/ubuntu-bots/tweak
Diff against target: 56 lines (+6/-5)
3 files modified
Bantracker/plugin.py (+2/-2)
Encyclopedia/plugin.py (+3/-2)
commoncgi.py (+1/-1)
To merge this branch: bzr merge lp:~jpds/ubuntu-bots/remove-md5-usage
Reviewer Review Type Date Requested Status
Terence Simpson code 2010-01-30 Pending
Review via email: mp+18320@code.launchpad.net
To post a comment you must log in.
Jonathan Davies (jpds) wrote :

Use hashlib instead of the old md5 module.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Bantracker/plugin.py'
2--- Bantracker/plugin.py 2010-01-30 15:19:53 +0000
3+++ Bantracker/plugin.py 2010-01-30 20:17:10 +0000
4@@ -54,7 +54,7 @@
5 import datetime
6 import time
7 import random
8-import md5
9+import hashlib
10 import threading
11
12 tz = 'UTC'
13@@ -554,7 +554,7 @@
14 if not self.registryValue('bansite'):
15 irc.error("No bansite set, please set supybot.plugins.Bantracker.bansite")
16 return
17- sessid = md5.new('%s%s%d' % (msg.prefix, time.time(), random.randint(1,100000))).hexdigest()
18+ sessid = hashlib.sha1('%s%s%d' % (msg.prefix, time.time(), random.randint(1,100000))).hexdigest()
19 self.db_run("INSERT INTO sessions (session_id, user, time) VALUES (%s, %s, %d);",
20 ( sessid, msg.nick, int(time.mktime(time.gmtime())) ) )
21 irc.reply('Log in at %s/bans.cgi?sess=%s' % (self.registryValue('bansite'), sessid), private=True)
22
23=== modified file 'Encyclopedia/plugin.py'
24--- Encyclopedia/plugin.py 2009-11-22 22:44:07 +0000
25+++ Encyclopedia/plugin.py 2010-01-30 20:17:10 +0000
26@@ -21,7 +21,8 @@
27 import supybot.conf as conf
28 import supybot.utils as utils
29 import supybot.ircutils as ircutils
30-import sys, os, re, md5, random, time
31+import sys, os, re, random, time
32+import hashlib
33
34 if sys.version_info >= (2, 5, 0):
35 import re
36@@ -909,7 +910,7 @@
37 return
38 cur = db.cursor()
39
40- sessid = md5.new('%s%s%d' % (msg.prefix, time.time(), random.randint(1,100000))).hexdigest()
41+ sessid = hashlib.sha1('%s%s%d' % (msg.prefix, time.time(), random.randint(1,100000))).hexdigest()
42 cur.execute("INSERT INTO sessions (session_id, user, time) VALUES (%s, %s, %d)",
43 (sessid, msg.nick, int(time.mktime(time.gmtime())) ))
44 db.commit()
45
46=== modified file 'commoncgi.py'
47--- commoncgi.py 2008-11-01 16:45:33 +0000
48+++ commoncgi.py 2010-01-30 20:17:10 +0000
49@@ -12,7 +12,7 @@
50 #
51 ###
52
53-import cgi, cgitb, re, sys, math, os, md5, sqlite, random, time, datetime, pytz, Cookie, StringIO, urllib2
54+import cgi, cgitb, re, sys, math, os, sqlite, random, time, datetime, pytz, Cookie, StringIO, urllib2
55 import cPickle as pickle
56 cgitb.enable()
57

Subscribers

People subscribed via source and target branches