Optimizing Hashing Functions to Minimize Code Repetition