.\" DO NOT MODIFY THIS FILE! It was generated by gdoc. .TH "oath_totp_generate2" 3 "2.6.11" "liboath" "liboath" .SH NAME oath_totp_generate2 \- API function .SH SYNOPSIS .B #include .sp .BI "int oath_totp_generate2(const char * " secret ", size_t " secret_length ", time_t " now ", unsigned " time_step_size ", time_t " start_offset ", unsigned " digits ", int " flags ", char * " output_otp ");" .SH ARGUMENTS .IP "const char * secret" 12 the shared secret string .IP "size_t secret_length" 12 length of \fIsecret\fP .IP "time_t now" 12 Unix time value to compute TOTP for .IP "unsigned time_step_size" 12 time step system parameter (typically 30) .IP "time_t start_offset" 12 Unix time of when to start counting time steps (typically 0) .IP "unsigned digits" 12 number of requested digits in the OTP, excluding checksum .IP "int flags" 12 flags indicating mode, one of \fBoath_totp_flags\fP .IP "char * output_otp" 12 output buffer, must have room for the output OTP plus zero .SH "DESCRIPTION" Generate a one\-time\-password using the time\-variant TOTP algorithm described in RFC 6238. The input parameters are taken as time values. The system parameter \fItime_step_size\fP describes how long the time window for each OTP is. The recommended value is 30 seconds, and you can use the value 0 or the symbol \fBOATH_TOTP_DEFAULT_TIME_STEP_SIZE\fP to indicate this. The system parameter \fIstart_offset\fP denote the Unix time when time steps are started to be counted. The recommended value is 0, to fall back on the Unix epoch) and you can use the symbol \fBOATH_TOTP_DEFAULT_START_TIME\fP to indicate this. The \fIoutput_otp\fP buffer must have room for at least \fIdigits\fP characters, plus one for the terminating NUL. Currently only values 6, 7 and 8 for \fIdigits\fP are supported. This restriction may be lifted in future versions. The \fIflags\fP parameter may be used to change the MAC function, for example \fBOATH_TOTP_HMAC_SHA256\fP or \fBOATH_TOTP_HMAC_SHA512\fP. .SH "RETURNS" On success, \fBOATH_OK\fP (zero) is returned, otherwise an error code is returned. .SH "SINCE" 2.6.0 .SH "REPORTING BUGS" Report bugs to . liboath home page: https://www.nongnu.org/oath-toolkit/ General help using GNU software: http://www.gnu.org/gethelp/ .SH COPYRIGHT Copyright \(co 2009-2020 Simon Josefsson. .br 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.