diff options
| author | 2007-12-30 22:08:50 +0100 | |
|---|---|---|
| committer | 2007-12-30 22:08:50 +0100 | |
| commit | 607e3c772fd6d39b40e544d815d457a8248333c1 (patch) | |
| tree | c894b330a4cc067c37223dd4e38738a7652cd1fd /mini-dinstall | |
| parent | ed83fe28c74522097f9aa2bd885618397bb83fa6 (diff) | |
add SHA256 hashes in release files
Diffstat (limited to 'mini-dinstall')
| -rwxr-xr-x | mini-dinstall | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mini-dinstall b/mini-dinstall index f576c51..92f3831 100755 --- a/mini-dinstall +++ b/mini-dinstall @@ -1171,6 +1171,15 @@ class ArchiveDirIndexer(threading.Thread): shasum.update(buf) buf = f.read(8192) return shasum.hexdigest() + elif type == 'sha256': + import Crypto.Hash.SHA256 + f = open(filename) + buf = f.read(8192) + shasum256 = SHA256.new(buf) + while buf != '': + shasum256.hash_update(buf) + buf = f.read(8192) + return shasum256.hash_digest() else: raise DinstallException('cannot compute hash of type %s; no builtin method or /usr/bin/%ssum', type, type) @@ -1375,6 +1384,12 @@ class SimpleSubdirArchiveDirIndexer(ArchiveDirIndexer): shasum = self._get_file_sum('sha1', absfile) size = os.stat(absfile)[stat.ST_SIZE] f.write(' %s% 16d %s\n' % (shasum, size, os.path.basename(absfile))) + f.write('SHA256:\n') + for file in indexfiles: + absfile = self._abspath(file) + shasum256 = self._get_file_sum('sha256', absfile) + size = os.stat(absfile)[stat.ST_SIZE] + f.write(' %s% 16d %s\n' % (shasum256, size, os.path.basename(absfile))) f.close() if self._sign_releasefile(os.path.basename(tmpname), self._abspath(arch)): os.rename(tmpname, targetname) @@ -1473,6 +1488,12 @@ class FlatArchiveDirIndexer(ArchiveDirIndexer): shasum = self._get_file_sum('sha1', absfile) size = os.stat(absfile)[stat.ST_SIZE] f.write(' %s% 16d %s\n' % (shasum, size, file)) + f.write('SHA256:\n') + for file in indexfiles: + absfile = self._abspath(file) + shasum256 = self._get_file_sum('sha256', absfile) + size = os.stat(absfile)[stat.ST_SIZE] + f.write(' %s% 16d %s\n' % (shasum256, size, file)) f.close() if self._sign_releasefile(tmpname, self._abspath()): os.rename(tmpname, targetname) |
