Commit 06fe46a
authored
Docs [Cryptographic Helper Function] (#191)
- [+] refactor(otpverifier): improve documentation for cryptoPow10n function
- [+] Key points:
- [+] The function calculates the value of 10 raised to the power of n (10ⁿ).
- [+] It uses recursive multiplication to compute the result.
- [+] The base case is when n ≤ 0, where the result is 1 (10⁰ = 1).
- [+] For n > 0, the function recursively multiplies 10 with the result of cryptoPow10n(n-1).
- [+] The function assumes that n is non-negative and returns 1 for negative values of n.
- [+] The purpose of the function is to calculate the appropriate modulo value based on the desired number of digits for HOTP and TOTP values.
- [+] The function is used in the truncation step of the HOTP and TOTP algorithms to ensure the resulting values have the specified number of digits.
- [+] The documentation includes a "Magic Calculator" section that explains the mathematical calculations performed by the function.1 parent 4fb2ff7 commit 06fe46a
1 file changed
+15
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
508 | 508 | | |
509 | 509 | | |
510 | 510 | | |
511 | | - | |
| 511 | + | |
512 | 512 | | |
513 | 513 | | |
514 | | - | |
| 514 | + | |
515 | 515 | | |
516 | 516 | | |
517 | 517 | | |
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
521 | | - | |
522 | | - | |
| 521 | + | |
| 522 | + | |
523 | 523 | | |
524 | 524 | | |
525 | 525 | | |
526 | | - | |
527 | | - | |
| 526 | + | |
528 | 527 | | |
529 | 528 | | |
530 | | - | |
531 | | - | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
532 | 539 | | |
533 | 540 | | |
534 | 541 | | |
| |||
0 commit comments