Dehash function written for a job exercise