Commits

anatoly techtonik committed f8339d6

Replace M2Crypto SHA1 hash calculation with function from stdlib

Comments (0)

Files changed (1)

 # system imports
 import sys, os, urllib, cStringIO, traceback, cgi, binascii, gzip
 import time, random, smtplib, base64, email, types, urlparse
-import re, zipfile, shutil, Cookie, subprocess, hashlib
+import re, zipfile, shutil, Cookie, subprocess
+import hashlib
 import logging
 from zope.pagetemplate.pagetemplatefile import PageTemplateFile
 from distutils.util import rfc822_escape
 
 # Importing M2Crypto patches urllib; don't let them do that
 orig = urllib.URLopener.open_https.im_func
-from M2Crypto import EVP, DSA
+from M2Crypto import DSA
 urllib.URLopener.open_https = orig
 
 # OpenId provider imports
         html = self.simple_body(path)
         if not self.privkey:
             self.privkey = DSA.load_key(os.path.join(self.config.key_dir, 'privkey'))
-        md = EVP.MessageDigest('sha1')
-        md.update(html)
-        digest = md.final()
+        digest = hashlib.sha1(html).digest()
         sig = self.privkey.sign_asn1(digest)
         self.handler.send_response(200, 'OK')
         self.handler.set_content_type('application/octet-stream')