Skip to content

Commit 765978b

Browse files
Merge pull request #37 from agonzalezro/patch-1
Fix small syntax typo in MFA example
2 parents b5eed24 + b755297 commit 765978b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pages/mfa.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ import (
6363
"math"
6464
)
6565

66-
func generateTOTP(secret []byte) {
66+
func generateTOTP(secret []byte) string {
6767
digits := 6
6868
counter := time.Now().Unix() / 30
6969

@@ -75,7 +75,7 @@ func generateTOTP(secret []byte) {
7575
HS := mac.Sum(nil)
7676
offset := HS[19] & 0x0f
7777
Snum := binary.BigEndian.Uint32(HS[offset:offset+4]) & 0x7fffffff
78-
D := Snum % int(math.Pow(10, float64(digits)))
78+
D := Snum % uint32(math.Pow(10, float64(digits)))
7979
// Pad "0" to make it 6 digits.
8080
return fmt.Sprintf("%06d", D)
8181
}

0 commit comments

Comments
 (0)