From dbd0288d599d2cb6fecf1e9bf7b4d0705a641f7a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bar=C4=B1=C5=9F=20Metin?= Date: Wed, 10 Feb 2010 09:54:10 +0000 Subject: [PATCH] use hashlib as md5 and sha are deprecated --- PLC/Auth.py | 4 ++-- PLC/Persons.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/PLC/Auth.py b/PLC/Auth.py index b11e8551..945c8ce5 100644 --- a/PLC/Auth.py +++ b/PLC/Auth.py @@ -9,7 +9,7 @@ # import crypt -import sha +import hashlib import hmac import time @@ -257,7 +257,7 @@ class BootAuth(Auth): # We encode in UTF-8 before calculating the HMAC, which is # an 8-bit algorithm. # python 2.6 insists on receiving a 'str' as opposed to a 'unicode' - digest = hmac.new(str(key), msg.encode('utf-8'), sha).hexdigest() + digest = hmac.new(str(key), msg.encode('utf-8'), hashlib.sha1).hexdigest() if digest != auth['value']: raise PLCAuthenticationFailure, "Call could not be authenticated" diff --git a/PLC/Persons.py b/PLC/Persons.py index 1d3059f2..59ff6ddc 100644 --- a/PLC/Persons.py +++ b/PLC/Persons.py @@ -10,7 +10,7 @@ from types import StringTypes from datetime import datetime -import md5 +import hashlib import time from random import Random import re @@ -116,7 +116,7 @@ class Person(Row): else: # Generate a somewhat unique 8 character salt string salt = str(time.time()) + str(Random().random()) - salt = md5.md5(salt).hexdigest()[:8] + salt = hashlib.md5(salt).hexdigest()[:8] return crypt.crypt(password.encode(self.api.encoding), magic + salt + "$") validate_date_created = Row.validate_timestamp -- 2.47.0