Suggesting we improve this slightly with functions.

I think we should improve this slightly by splitting the file into two functions hashFile and setup. Currently the file is one large python script, which perhaps would be far better split into functions. 

There is some "sudo" code in garethpaul:master which includes the suggestion to split this into two functions. Having said this longer term I think it would make more sense to combine args and flags into a single dictionary in setup. 
Should these be populated if we're committing this?