EmilienCourt 9ebea46300
totp : rework and add SHA256/512 (#151)
* totp : rework and add SHA256/512

* totp : comment code

* totp : fix SHA224/SHA384 and examples

* totp : fix bug in totp_face_lfs

* totp : init_totp_record to SHA1

* totp : move TOTP-MCU to TOTP, update README and example

* totp : SHAX, use size_t n instead of harcoded 8

* clarify what to put in TOTP face

Co-authored-by: Emilien <Emilien>
Co-authored-by: joeycastillo <joeycastillo@utexas.edu>
2023-01-14 11:58:03 -05:00

22 lines
464 B
C

#ifndef TOTP_H_
#define TOTP_H_
#include <inttypes.h>
#include "time.h"
typedef enum {
SHA1,
SHA224,
SHA256,
SHA384,
SHA512
} hmac_alg;
void TOTP(uint8_t* hmacKey, uint8_t keyLength, uint32_t timeStep, hmac_alg algorithm);
void setTimezone(uint8_t timezone);
uint32_t getCodeFromTimestamp(uint32_t timeStamp);
uint32_t getCodeFromTimeStruct(struct tm time);
uint32_t getCodeFromSteps(uint32_t steps);
#endif // TOTP_H_