Implementation of the routine to hash passwords