From: Michael Vrable Date: Fri, 31 Aug 2012 03:15:27 +0000 (-0700) Subject: Switch to hashlib (Python >= 2.5) for hash algorithms. X-Git-Url: http://git.vrable.net/?p=cumulus.git;a=commitdiff_plain;h=e8f99f8ccafa3c0c08e370413f0e4d6142582fb4 Switch to hashlib (Python >= 2.5) for hash algorithms. The old sha module is deprecated, and hashlib gives access to newer hash algorithms. Use it to add SHA-256 support as well. --- diff --git a/README b/README index 19188f7..bb83b25 100644 --- a/README +++ b/README @@ -6,11 +6,11 @@ How to Build Dependencies: - libuuid (sometimes part of e2fsprogs) - sqlite3 + - Python (2.5 or later) - boto, the python interface to Amazon's Web Services (for S3 storage) http://code.google.com/p/boto - paramiko, SSH2 protocol for python (for sftp storage) http://www.lag.net/paramiko/ - - python 2.5+ for sftp storage backend Building should be a simple matter of running "make". This will produce an executable called "cumulus". diff --git a/python/cumulus/__init__.py b/python/cumulus/__init__.py index ff811b0..3f6b6f7 100644 --- a/python/cumulus/__init__.py +++ b/python/cumulus/__init__.py @@ -9,7 +9,7 @@ various parts of a Cumulus archive: """ from __future__ import division -import os, re, sha, tarfile, tempfile, thread +import hashlib, os, re, tarfile, tempfile, thread from pysqlite2 import dbapi2 as sqlite3 import cumulus.store, cumulus.store.file @@ -56,7 +56,8 @@ class Struct: return "<%s %s>" % (self.__class__, self.__dict__) CHECKSUM_ALGORITHMS = { - 'sha1': sha.new + 'sha1': hashlib.sha1, + 'sha256': hashlib.sha256, } class ChecksumCreator: