[4.2] Hashing : factorize calculation of the cost