oath_hotp_validate(3)

✨ NAME ✨

oath_hotp_validate β€” API function. Yep, that’s the whole name bestie, and this page lives under the manual name liboath πŸ«ΆπŸ’–.

🌸 SYNOPSIS 🌸

#include <oath.h>

int oath_hotp_validate(const char * secret, size_t secret_length,
       uint64_t start_moving_factor, size_t window, const char * otp);

πŸŽ€ ARGUMENTS πŸŽ€

  • const char * secret β€” the shared secret string πŸ”
  • size_t secret_length β€” length of secret πŸ“
  • uint64_t start_moving_factor β€” start counter in OTP stream πŸ”’
  • size_t window β€” how many OTPs after start counter to test πŸͺŸ
  • const char * otp β€” the OTP to validate. βœ…

πŸ’– DESCRIPTION πŸ’–

Okay so this function validates an OTP according to the OATH HOTP algorithm per RFC 4226. Literally the main character of this whole page ✨.

Currently only OTP lengths of 6, 7 or 8 digits are supported. This restrictions may be lifted in future versions, although some limitations are inherent in the protocol β€” so yeah, some protocol limits are just built different πŸ’€.

πŸ”₯ RETURNS πŸ”₯

It returns position in OTP window (zero is first position), or OATH_INVALID_OTP if no OTP was found in OTP window, or an error code. That’s the return-value tea β˜•πŸ‘‘

πŸ› REPORTING BUGS πŸ›

Report bugs to <oath-toolkit-help@nongnu.org> πŸ“¬.

Copyright Β© 2009-2026 Simon Josefsson.

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.


Signing off with liboath 2.6.15 β€” that’s the footer’s source/version flex, and there’s no date in the footer, just vibes πŸ«ΆπŸ’œπŸŽ€

πŸ“¦ where this page comes from