-fix TOTP calculation
This commit is contained in:
parent
5f9c3021db
commit
cc34502ac1
@ -102,7 +102,7 @@ compute_totp (struct GNUNET_TIME_Timestamp ts,
|
|||||||
|
|
||||||
offset = hmac[sizeof (hmac) - 1] & 0x0f;
|
offset = hmac[sizeof (hmac) - 1] & 0x0f;
|
||||||
for (int count = 0; count < 4; count++)
|
for (int count = 0; count < 4; count++)
|
||||||
code |= hmac[offset + 3 - count] << (8 * count);
|
code |= ((uint32_t) hmac[offset + 3 - count]) << (8 * count);
|
||||||
code &= 0x7fffffff;
|
code &= 0x7fffffff;
|
||||||
/* always use 8 digits (maximum) */
|
/* always use 8 digits (maximum) */
|
||||||
code = code % 100000000;
|
code = code % 100000000;
|
||||||
|
Loading…
Reference in New Issue
Block a user