1oath_hotp_generate(3) liboath oath_hotp_generate(3)
2
3
4
6 oath_hotp_generate - API function
7
9 #include <oath.h>
10
11 int oath_hotp_generate(const char * secret, size_t secret_length,
12 uint64_t moving_factor, unsigned digits, bool add_checksum, size_t
13 truncation_offset, char * output_otp);
14
16 const char * secret
17 the shared secret string
18
19 size_t secret_length
20 length of secret
21
22 uint64_t moving_factor
23 a counter indicating the current OTP to generate
24
25 unsigned digits
26 number of requested digits in the OTP, excluding checksum
27
28 bool add_checksum
29 whether to add a checksum digit or not
30
31 size_t truncation_offset
32 use a specific truncation offset
33
34 char * output_otp
35 output buffer, must have room for the output OTP plus zero
36
38 Generate a one-time-password using the HOTP algorithm as described in
39 RFC 4226.
40
41 Use a value of OATH_HOTP_DYNAMIC_TRUNCATION for truncation_offset
42 unless you really need a specific truncation offset.
43
44 To find out the size of the OTP you may use the OATH_HOTP_LENGTH()
45 macro. The output_otp buffer must be have room for that length plus
46 one for the terminating NUL.
47
48 Currently only values 6, 7 and 8 for digits are supported, and the
49 add_checksum value is ignored. These restrictions may be lifted in
50 future versions, although some limitations are inherent in the proto‐
51 col.
52
54 On success, OATH_OK (zero) is returned, otherwise an error code is
55 returned.
56
58 Report bugs to <oath-toolkit-help@nongnu.org>. liboath home page:
59 http://www.gnu.org/software/liboath/ General help using GNU software:
60 http://www.gnu.org/gethelp/
61
63 Copyright © 2009-2020 Simon Josefsson.
64 Copying and distribution of this file, with or without modification,
65 are permitted in any medium without royalty provided the copyright
66 notice and this notice are preserved.
67
68
69
70liboath 2.6.6 oath_hotp_generate(3)