[Security] Made optimization on constant-time algorithm removing modulus operator

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

This fix improves the constant-time algorithm used to compare strings, as it removes the `%` operator inside the loop.