Hi, Here's a huge batch of patches for portage.checksum and relevant stuff. It's not a complete rewrite as I have originally planned, and it's still not the code I'd like to see but functionally it has been improved a lot.
Notable changes: 1. Other modules no longer use hashfunc_map, now they use the public functions instead. 2. A method to checksum byte strings (i.e. stuff in-memory) has been added. For better compatibility, practically unused python-fchksum support has been removed. [TODO: possibly port other uses of hashlib in Portage?] 3. Tests for all hash functions have been added. This makes it possible to verify that different implementations are working correctly. It is especially important because some of the Keccak (SHA-3) implementations are using pre-FIPS Keccak version. [TODO: make it possible to test all available fallbacks, not only the used function] 4. Fallbacks have been reworked so that the relevant modules are loaded only if a better implementation is not available already. Fallbacks for functions that are guaranteed to be available in hashlib have been removed. 5. Support using pygcrypt as provider of optimized hash function fallbacks (for ripemd160, Whirlpool and SHA3). 6. Support for Streebog (GOST R 34.11-2012) hash algorithm, provided either by pygcrypt or pure Python pygost module. [TODO: find a better pure Python provider] -- Best regards, Michał Górny