[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [bridgedb/develop] Apply patch by ovnicraft to use hashlib rather than sha module.
commit fc9fcd68378f381444d59de474827b0e6216ee81
Author: ovnicraft <tor-assistants@xxxxxxxxxxxxxxxxxxxx>
Date: Thu Nov 28 19:11:34 2013 +0000
Apply patch by ovnicraft to use hashlib rather than sha module.
* FIXES #9988
---
lib/bridgedb/Bridges.py | 4 ++--
lib/bridgedb/Storage.py | 10 +++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/bridgedb/Bridges.py b/lib/bridgedb/Bridges.py
index f8ec2c3..2bfa288 100644
--- a/lib/bridgedb/Bridges.py
+++ b/lib/bridgedb/Bridges.py
@@ -10,7 +10,7 @@ import bisect
import hmac
import logging
import re
-import sha
+import hashlib
import socket
import time
import ipaddr
@@ -27,7 +27,7 @@ from bridgedb.parse import networkstatus
HEX_FP_LEN = 40
ID_LEN = 20
-DIGESTMOD = sha
+DIGESTMOD = hashlib.sha1
HEX_DIGEST_LEN = 40
DIGEST_LEN = 20
PORTSPEC_LEN = 16
diff --git a/lib/bridgedb/Storage.py b/lib/bridgedb/Storage.py
index b0dada6..edcc566 100644
--- a/lib/bridgedb/Storage.py
+++ b/lib/bridgedb/Storage.py
@@ -8,7 +8,7 @@ import logging
import binascii
import sqlite3
import time
-import sha
+import hashlib
from ipaddr import IPAddress, IPv6Address, IPv4Address
import bridgedb.Stability as Stability
@@ -262,7 +262,7 @@ class Database:
cur.execute("DELETE FROM EmailedBridges WHERE when_mailed < ?", (t,))
def getEmailTime(self, addr):
- addr = sha.new(addr).hexdigest()
+ addr = hashlib.new(addr).hexdigest()
cur = self._cur
cur.execute("SELECT when_mailed FROM EmailedBridges WHERE "
"email = ?", (addr,))
@@ -272,7 +272,7 @@ class Database:
return strToTime(v[0])
def setEmailTime(self, addr, whenMailed):
- addr = sha.new(addr).hexdigest()
+ addr = hashlib.new(addr).hexdigest()
cur = self._cur
t = timeToStr(whenMailed)
cur.execute("INSERT OR REPLACE INTO EmailedBridges "
@@ -359,7 +359,7 @@ class Database:
return True
def getWarnedEmail(self, addr):
- addr = sha.new(addr).hexdigest()
+ addr = hashlib.new(addr).hexdigest()
cur = self._cur
cur.execute("SELECT * FROM WarnedEmails WHERE "
" email = ?", (addr,))
@@ -369,7 +369,7 @@ class Database:
return True
def setWarnedEmail(self, addr, warned=True, whenWarned=time.time()):
- addr = sha.new(addr).hexdigest()
+ addr = hashlib.new(addr).hexdigest()
t = timeToStr(whenWarned)
cur = self._cur
if warned == True:
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits