The algorithm of moving boxes to estimate Lyapunov exponents and the singularity spectrum