This is a snapshot of Indico's old Trac site. Any information contained herein is most probably outdated. Access our new GitHub site here.

Ticket #1076: 0001-REF-Do-not-use-deprecated-md5-sha-modules.patch

File 0001-REF-Do-not-use-deprecated-md5-sha-modules.patch, 2.5 KB (added by pedersen, 3 years ago)
  • indico/MaKaC/export/oai2.py

    From 3477cee63fa0faca4a4be452d71c3d46215786f2 Mon Sep 17 00:00:00 2001
    From: Bjoern Pedersen <bjoern.pedersen@frm2.tum.de>
    Date: Mon, 20 Aug 2012 14:00:39 +0200
    Subject: [PATCH] [REF] Do not use deprecated md5/sha modules
    
     * use hashlib instead of the deprecated modules
    ---
     indico/MaKaC/export/oai2.py                        | 4 ++--
     indico/MaKaC/services/interface/rpc/description.py | 4 ++--
     indico/MaKaC/webinterface/session/base.py          | 4 ++--
     3 Dateien geÀndert, 6 Zeilen hinzugefÌgt(+), 6 Zeilen entfernt(-)
    
    diff --git a/indico/MaKaC/export/oai2.py b/indico/MaKaC/export/oai2.py
    index 4700d48..59658be 100644
    a b import string 
    2828from string import split 
    2929import re 
    3030import time 
    31 import md5 
     31import hashlib 
    3232from datetime import datetime 
    3333from pytz import timezone 
    3434 
    class OAIResponse: 
    13101310    def OAIGenResumptionToken(self): 
    13111311        "Generates unique ID for resumption token management." 
    13121312 
    1313         return md5.new(str(time.time())).hexdigest() 
     1313        return hashlib.md5(str(time.time())).hexdigest() 
    13141314 
    13151315 
    13161316    def OAICacheIn(self, resumptionToken, sysnos): 
  • indico/MaKaC/services/interface/rpc/description.py

    diff --git a/indico/MaKaC/services/interface/rpc/description.py b/indico/MaKaC/services/interface/rpc/description.py
    index 443c8ed..d7ce973 100644
    a b  
    11from MaKaC.common import Config 
    22 
    3 import sha 
     3import hashlib 
    44 
    55def fetchClasses(module, namespace): 
    66    table = {} 
    def describe(params, remoteHost, session): 
    5252    from MaKaC.services.interface.rpc import handlers 
    5353 
    5454    # a unique identifier for the service 
    55     shaObj = sha.new(Config.getInstance().getBaseURL()) 
     55    shaObj = hashlib.sha1(Config.getInstance().getBaseURL()) 
    5656    jsonRpcServiceId = shaObj.hexdigest() 
    5757    # endpoint 
    5858    jsonRpcServiceURL = Config.getInstance().getBaseURL() + '/services/json-rpc/' 
  • indico/MaKaC/webinterface/session/base.py

    diff --git a/indico/MaKaC/webinterface/session/base.py b/indico/MaKaC/webinterface/session/base.py
    index b403f88..304a022 100644
    a b try: 
    111111 
    112112except IOError: 
    113113    # this is much less secure than the above function 
    114     import sha 
    115     _randstate = sha.new(str(time() + clock())) 
     114    import hashlib 
     115    _randstate = hashlib.sha1(str(time() + clock())) 
    116116    def randlong(bytes): 
    117117        """Return bits of random data as a long integer.""" 
    118118        global _randstate