Refactor proof of work related functions out of main

I'm not sure if ScanHash_CryptoPP on miner.cpp would fit here too.