Reduce the odds of a collision in image keys

Fixes #27
move key generator to its own class and add test
remove unused imports
Merge branch 'better_disk_cache_hash'