Giter Club home page Giter Club logo

Comments (5)

paolostivanin avatar paolostivanin commented on June 10, 2024 1

Try without base32 encoding K.

from libcotp.

paolostivanin avatar paolostivanin commented on June 10, 2024 1

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.

paolostivanin avatar paolostivanin commented on June 10, 2024

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.

yesvivek avatar yesvivek commented on June 10, 2024

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
Linux debian7-x64 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2 x86_64 GNU/Linux
root@debian7-x64:
/totp# gcc -v
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.

yesvivek avatar yesvivek commented on June 10, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.