otpcli/otp.h
Lucas 22333c5d6e Change totp to take a uint64_t instead of time_t
Let the application deal with converting time_t to uint64_t. For TOTP,
it's just a counter.

While there, rename 'granularity' to 'step', as it's used in RFC 6238.
2020-06-14 17:13:07 +00:00

27 lines
742 B
C

/*
* otpcli - CLI utility for generating OTPs
*
* Written in 2020 by Lucas
*
* To the extent possible under law, the author(s) have dedicated all
* copyright and related and neighboring rights to this software to the
* public domain worldwide. This software is distributed without any
* warranty.
*
* You should have received a copy of the CC0 Public Domain Dedication
* along with this software. If not, see
* <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
#include <stdint.h>
enum otp_hmac {
OTP_HMAC_SHA1,
OTP_HMAC_SHA256,
OTP_HMAC_SHA512,
};
int32_t hotp(enum otp_hmac, const void *, size_t, uint64_t, unsigned int);
int32_t totp(enum otp_hmac, const void *, size_t, uint64_t, unsigned int,
unsigned int);