A minimal implementation of the TOTP and HOTP algorithms.
- C99-compliant C compiler
- OpenSSL
- (optional) GNU Make
Run make
to compile simpleTOTP.o
and run a simple test suite.
MIT, see LICENCE
file for full text.
A very simple server-side implementation of the TOTP algorithm.
License: MIT License
Your project is very good.
But, your project is 4 errors.
These are my compile errors.
test.cpp:8:21: error: cannot initialize an array element of type 'uint8_t *' (aka 'unsigned char *') with an lvalue of type 'const char[21]'
uint8_t* keys[] = {"12345678901234567890"};
^~~~~~~~~~~~~~~~~~~~~~
test.cpp:15:29: error: invalid application of 'sizeof' to an incomplete type 'uint8_t *[]'
uint32_t solutions[][sizeof(keys) / sizeof(keys[0])] =
^~~~~~
test.cpp:24:28: error: invalid application of 'sizeof' to an incomplete type 'uint8_t *[]'
for (int i = 0; i < sizeof(keys) / sizeof(keys[0]); ++i)
^~~~~~
test.cpp:28:34: error: no matching function for call to 'strlen'
int32_t token = totp(keys[i], strlen(keys[i]), times[j], 8);
^~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/string.h:82:9: note: candidate function not viable: no known conversion from 'uint8_t *' (aka 'unsigned char *') to 'const char *' for 1st argument
size_t strlen(const char *__s);
How can I fix them?
Environment
ProductName : macOS
ProductVersion : 13.1
BuildVersion : 22C65
command : g++ -std=c++20 test.cpp
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.