For what it's worth;
$ time python linearize-hashes.py linearize.cfg > hashlist.txt.1
real 4m47.909s
user 2m45.033s
sys 0m49.987s
$ time python linearize-hashes-new.py linearize.cfg > hashlist.txt.2
real 0m9.487s
user 0m2.721s
sys 0m0.363s
$ sha256sum hashlist.txt*
e89d542fb65666eeb63c0a74995e7481b8349d9b48f9139f3ef3056c462837ab hashlist.txt.1
e89d542fb65666eeb63c0a74995e7481b8349d9b48f9139f3ef3056c462837ab hashlist.txt.2
(speedup about 30×)