A dynamic algorithm for palmprint recognition