Rating:
TL:DR;
1. Reverse the algorithm2. Optimise it
Too short? Read the detailed writeup in the link :)
I don't remember