Giter Site home page Giter Site logo

arduino-oath-token's Introduction

ARDUINO-OATH-TOKEN
==================

This is a basic Open-Source implementation of a TOTP (compliant with OATH*) code in Arduino.
Basicaly it generates 6 digits OTP based in a EPOCH time stored in a variable called birthTime
There is no time drift. The OTP is updated each 30 seconds.

For HMAC-SHA1 hash this implementation uses the code from Cathedrow / Cryptosuite (https://github.com/Cathedrow/Cryptosuite). 
However a small change was added to sha1.h and sha1.c: The method size_t Sha1Class::writebytes(const uint8_t* data, int length)

For debug purposes the main important functions are printed to serial output.

A picture of a working prototype can be found at: 
https://github.com/damico/ARDUINO-OATH-TOKEN/blob/master/arduino-oath-token-prototype.png

*http://www.openauthentication.org/

For compilation purposes, make sure that you have the following directory structure:

---> ARDUINO-OATH-TOKEN/
---> ---> arduino_oath_token/
---> ---> ---> arduino_oath_token.ino
---> ---> Sha/
---> ---> ---> sha1.cpp  
---> ---> ---> sha1.h 

Also, check you libraries directory inside arduino installation folder. It must contain the Sha folder inside it (the arduino installation folder may have different locations and versions, depending of OS).

---> arduino-1.0.1/
---> ---> libraries/
---> ---> ---> Sha
---> ---> ---> ---> sha1.cpp  
---> ---> ---> ---> sha1.h 

The Sha library folder can be found at https://github.com/Cathedrow/Cryptosuite as mentioned before but change the sha1.cpp and sha1.h by the ones found at https://github.com/damico/ARDUINO-OATH-TOKEN/tree/master/Sha repository.

author: Jose (Ricardo de Oliveira) Damico (jd dot comment at gmail dot com)

arduino-oath-token's People

Contributors

damico avatar vlee489 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino-oath-token's Issues

New 32 character google auth key

Google apparently changed to using 32 character base32 keys instead of 16 character. To use your library could I just change:

Sha1.initHmac(hmacKey1,16);

to

Sha1.initHmac(hmacKey1,32);

And of course, use 32 bytes in hmacKey?

Well, or maybe 20 instead of 32.

I used the following python to convert the 32 character base32:

import base64
print ', '.join([hex(ord(i)) for i in base64.b32decode('notmyactualsecret32charkey'.upper())])

And it gave me a 20 byte hmacKey value. Does that make sense?

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.