Algorithms for Dynamic Hardness Measurements by Scratch Testing in the Submicron and Nanometer Scale