It prevents temporary attacks against cryptosystems: Any code path takes exactly the same amount of time.
If you are careless about time, you open a side channel that comforts information about your secret. For example. you can determine that the first character of the password is “R” because the system does not work 10ns faster if your incorrect password starts with “R”. Repeat with the following character until you find the password.
The implementation of cryptography is really complex. It is actually very difficult.
Volker
source share