diff MoinMoin/util/moinoid.py @ 4363:817d99d715fe

remove direct usage of deprecated sha module - use hashlib, if possible
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 03 Oct 2008 22:33:35 +0200
parents a48929a5036c
children 500f68d3e2fd
line wrap: on
line diff
--- a/MoinMoin/util/moinoid.py	Fri Oct 03 21:18:49 2008 +0200
+++ b/MoinMoin/util/moinoid.py	Fri Oct 03 22:33:35 2008 +0200
@@ -5,7 +5,6 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-from sha import sha
 from random import randint
 import time
 
@@ -15,6 +14,7 @@
 from openid.store import nonce
 
 from MoinMoin import caching
+from MoinMoin.support.python_compatibility import hash_new
 
 from MoinMoin import log
 logging = log.getLogger(__name__)
@@ -53,7 +53,7 @@
 
     def key(self, url):
         '''return cache key'''
-        return sha(url).hexdigest()
+        return hash_new('sha1', url).hexdigest()
 
     def storeAssociation(self, server_url, association):
         ce = caching.CacheEntry(self.request, 'openid', self.key(server_url),
@@ -104,7 +104,7 @@
 
     def useNonce(self, server_url, timestamp, salt):
         val = ''.join([str(server_url), str(timestamp), str(salt)])
-        csum = sha(val).hexdigest()
+        csum = hash_new('sha1', val).hexdigest()
         ce = caching.CacheEntry(self.request, 'openid-nonce', csum,
                                 scope='farm', use_pickle=False)
         if ce.exists():