SWE-350 TOTP Generator Milestone 5
The DE-10 board has six 7-segment displays, this can be used to display and generate a time based one-time pin (TOTP).
Loading...
Searching...
No Matches
TOTP.c File Reference
#include "TOTP.h"
#include "sha1.h"
Include dependency graph for TOTP.c:

Go to the source code of this file.

Functions

void TOTP (uint8_t *hmacKey, uint8_t keyLength, uint32_t timeStep)
 TOTP Object, main object for the code generator.
 
void setTimezone (uint8_t timezone)
 Set the timezone from UTC, Arizona is always -7, so this is what is hard encoded into main.
 
uint32_t TimeStruct2Timestamp (struct tm time)
 Accepts a time struct from struct tm, returns it as a timestamp.
 
uint32_t getCodeFromTimestamp (uint32_t timeStamp)
 Accepts a timestamp from uint32_t, returns the code in uint32_t.
 
uint32_t getCodeFromTimeStruct (struct tm time)
 Accepts a timestamp from struct tm, returns the code in uint32_t, not used for the current project From the TOTP library.
 
uint32_t getCodeFromSteps (uint32_t steps)
 Accepts a number of steps for a HMAC based code, not used for this project From the TOTP library.
 

Variables

uint8_t * _hmacKey
 
uint8_t _keyLength
 
uint8_t _timeZoneOffset
 
uint32_t _timeStep
 

Function Documentation

◆ getCodeFromSteps()

uint32_t getCodeFromSteps ( uint32_t steps)

Accepts a number of steps for a HMAC based code, not used for this project From the TOTP library.

Definition at line 40 of file TOTP.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCodeFromTimestamp()

uint32_t getCodeFromTimestamp ( uint32_t timeStamp)

Accepts a timestamp from uint32_t, returns the code in uint32_t.

Definition at line 29 of file TOTP.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCodeFromTimeStruct()

uint32_t getCodeFromTimeStruct ( struct tm time)

Accepts a timestamp from struct tm, returns the code in uint32_t, not used for the current project From the TOTP library.

Definition at line 35 of file TOTP.c.

Here is the call graph for this function:

◆ setTimezone()

void setTimezone ( uint8_t timezone)

Set the timezone from UTC, Arizona is always -7, so this is what is hard encoded into main.

Definition at line 16 of file TOTP.c.

Here is the caller graph for this function:

◆ TimeStruct2Timestamp()

uint32_t TimeStruct2Timestamp ( struct tm time)

Accepts a time struct from struct tm, returns it as a timestamp.

Definition at line 22 of file TOTP.c.

Here is the caller graph for this function:

◆ TOTP()

void TOTP ( uint8_t * hmacKey,
uint8_t keyLength,
uint32_t timeStep )

TOTP Object, main object for the code generator.

Definition at line 10 of file TOTP.c.

Here is the caller graph for this function:

Variable Documentation

◆ _hmacKey

uint8_t* _hmacKey

Definition at line 4 of file TOTP.c.

◆ _keyLength

uint8_t _keyLength

Definition at line 5 of file TOTP.c.

◆ _timeStep

uint32_t _timeStep

Definition at line 7 of file TOTP.c.

◆ _timeZoneOffset

uint8_t _timeZoneOffset

Definition at line 6 of file TOTP.c.