left-pad TOTP code with 0s

This commit is contained in:
Christian Grothoff 2023-04-02 14:12:13 +02:00
parent e99450e2e2
commit 979ec38ec4
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -189,7 +189,7 @@ executive_totp (void *h_key,
if (NULL == ret) if (NULL == ret)
{ {
GNUNET_asprintf (&ret, GNUNET_asprintf (&ret,
"%llu", "%08llu",
(unsigned long long) code); (unsigned long long) code);
} }
else else
@ -197,7 +197,7 @@ executive_totp (void *h_key,
char *tmp; char *tmp;
GNUNET_asprintf (&tmp, GNUNET_asprintf (&tmp,
"%s\n%llu", "%s\n%08llu",
ret, ret,
(unsigned long long) code); (unsigned long long) code);
GNUNET_free (ret); GNUNET_free (ret);