Only multiply hash with prime once