Specify the OTP width while printing
This commit is contained in:
parent
41ca24d151
commit
88ec5427c7
4
cli.c
4
cli.c
@ -72,13 +72,13 @@ main(int argc, char *argv[])
|
|||||||
r = hotp(OTP_HMAC_SHA1, argv[0], strlen(argv[0]), counter, 6);
|
r = hotp(OTP_HMAC_SHA1, argv[0], strlen(argv[0]), counter, 6);
|
||||||
if (r == -1)
|
if (r == -1)
|
||||||
errx(1, "couldn't calculate HOTP");
|
errx(1, "couldn't calculate HOTP");
|
||||||
printf("%" PRId32 "\n", r);
|
printf("%0*" PRId32 "\n", 6, r);
|
||||||
} else {
|
} else {
|
||||||
r = totp(OTP_HMAC_SHA1, argv[0], strlen(argv[0]), counter,
|
r = totp(OTP_HMAC_SHA1, argv[0], strlen(argv[0]), counter,
|
||||||
30, 8);
|
30, 8);
|
||||||
if (r == -1)
|
if (r == -1)
|
||||||
errx(1, "couldn't calculate TOTP");
|
errx(1, "couldn't calculate TOTP");
|
||||||
printf("%" PRId32 "\n", r);
|
printf("%0*" PRId32 "\n", 8, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user