Wrote multithreaded code for key generation.