Comments (5)
Try without base32 encoding K.
from libcotp.
Good to know :)
In the meanwhile, I have released v1.0.9. This release will help to prevent such cases in the future.
from libcotp.
Hi,
yes, it's compatible with Google Authenticator. Please keep in mind that most of the times the secret a website gives you is already base32 encoded.
For example, if you go to this website you have to pass to the get_totp
function the upper case letters secret written at the bottom of the page.
Thanks for the input though. I will think a way to handle such cases.
If you have any suggestion just let me know :)
from libcotp.
Hi, Thanks for replying. I have tried your library with below code, but it is not working with Google Authenticator,
#include <stdio.h>
#include <baseencode.h>
#include "cotp.h"
#define K "RJB4USNOCNWGHNEF"
int main()
{
char *K_base32 = base32_encode(K, strlen(K)+1);
printf( "%s\n", K_base32 );
printf( "%s\n", get_totp( K_base32, 6, SHA1 ) );
//printf( "%s\n", get_totp( K_base32, 6, SHA256 ) );
//printf( "%s\n", get_totp( K_base32, 6, SHA512 ) );
}
The codes from Google Authenticator is not matching with this.
I compile with
gcc -g3 -O0 -lcrypto totp.c 1.c
root@debian7-x64:
/totp# uname -a/totp# gcc -v
Linux debian7-x64 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2 x86_64 GNU/Linux
root@debian7-x64:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 7.2.0-6' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.2.0 (Debian 7.2.0-6)
Appreciate your help on this..
from libcotp.
@paolostivanin you are awesome. It works now!
Tried this before posting the above comment, but had a seg-fault; that turns out to be because of different issue.
Thanks a lot!!
from libcotp.
Related Issues (15)
- Add pkg-config file
- Add steam support
- Add support for 60s tokens
- License collision with libbaseencode HOT 6
- SOVERSION should be set manually HOT 1
- Add option in CMakeLists to enable tests
- Add support for custom digits
- investigate potential regression in 1.2.0 HOT 4
- Exception running... HOT 4
- Tests should not need install to build
- No package 'baseencode' found HOT 2
- pkg-config file is broken when CMAKE_INSTALL_{INCLUDE,LIB}DIR is absolute HOT 4
- improve docu
- Add battle.net support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libcotp.