diff options
author | Helmut Grohne <helmut@subdivi.de> | 2014-02-19 14:21:20 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2014-02-19 14:21:20 +0100 |
commit | 332ac9eafb235443f163c606ced95dcbd615815e (patch) | |
tree | 00a3071fe331f4ed52ac058bf3616e55b24bed69 /importpkg.py | |
parent | d467a2a4e85d4b6f09bd2e3dc70466bfcc45a577 (diff) | |
download | debian-dedup-332ac9eafb235443f163c606ced95dcbd615815e.tar.gz |
blacklist content rather than hashes
Otherwise the gzip hash cannot tell the empty stream and the
compressed empty stream apart.
Diffstat (limited to 'importpkg.py')
-rwxr-xr-x | importpkg.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/importpkg.py b/importpkg.py index 54f6181..cb16f97 100755 --- a/importpkg.py +++ b/importpkg.py @@ -16,26 +16,21 @@ import yaml from dedup.arreader import ArReader from dedup.debpkg import process_control, get_tar_hashes -from dedup.hashing import HashBlacklist, DecompressedHash, SuppressingHash, \ - HashedStream +from dedup.hashing import DecompressedHash, SuppressingHash, HashedStream, \ + HashBlacklistContent from dedup.compression import GzipDecompressor, DecompressedStream from dedup.image import GIFHash, PNGHash -boring_sha512_hashes = set(( - # "" - "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e", - # "\n" - "be688838ca8686e5c90689bf2ab585cef1137c999b48c70b92f67a5c34dc15697b5d11c982ed6d71be1e1e7f7b4e0733884aa97c3f7a339a8ed03577cf74be09")) +boring_content = set(("", "\n")) def sha512_nontrivial(): - return HashBlacklist(hashlib.sha512(), boring_sha512_hashes) + return HashBlacklistContent(hashlib.sha512(), boring_content) def gziphash(): hashobj = DecompressedHash(GzipDecompressor(), hashlib.sha512()) hashobj = SuppressingHash(hashobj, (ValueError, zlib.error)) hashobj.name = "gzip_sha512" - # don't blacklist boring hashes for gzip to get gzip issues right - return hashobj + return HashBlacklistContent(hashobj, boring_content) def pnghash(): hashobj = PNGHash(hashlib.sha512()) |