mirror of
https://github.com/Hizenberg469/OTP-rfc4226-rfc6238-rfc4648.git
synced 2026-04-20 02:12:24 +03:00
Working model finished
This commit is contained in:
40
include/rfc4226.h
Normal file
40
include/rfc4226.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef RFC4226_H
|
||||
#define RFC4226_H
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
* Interface API for this library.
|
||||
*/
|
||||
|
||||
uint32_t HOTP(uint8_t* key, size_t kl, uint64_t interval, int digits);
|
||||
|
||||
/*
|
||||
* Step 1 -> Calling hmac function from openssl
|
||||
* library. It is used to create a 160-bit
|
||||
* integer value which is processed further.
|
||||
* It take a string key as an argument and
|
||||
* a seed value for calculation.
|
||||
* ->unsigned char* key -> key string
|
||||
* ->uint64_t interval -> seed value
|
||||
* |
|
||||
* |
|
||||
* -------> This seed value can be integer counter or
|
||||
* timer value as an argument.
|
||||
*/
|
||||
|
||||
uint8_t* hmac(unsigned char* key, int kl, uint64_t interval);
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Step 2 -> This function will truncate some bits to produce
|
||||
* a binary sequence of 32-bit. The 160-bit binary
|
||||
* sequence should in big-endian binary format for
|
||||
* processing.
|
||||
*/
|
||||
|
||||
uint32_t DT(uint8_t* rawData);
|
||||
#endif
|
||||
16
include/rfc6238.h
Normal file
16
include/rfc6238.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef RFC6238_H
|
||||
#define RFC6238_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
#include "rfc4226.h"
|
||||
|
||||
#define TS 30 /* time step in seconds, default value */
|
||||
|
||||
uint32_t TOTP(uint8_t* key, size_t kl, uint64_t time, int digits);
|
||||
time_t get_time(time_t T0);
|
||||
#endif
|
||||
Reference in New Issue
Block a user