How do you calculate the 6 digit Time-based One Time Password?

Im making calculating device that displays the 6 digit one time password for my online accounts. I got everything i think i need. but im having trouble searching on how to calculate the 6 digit?

I have the secret key its alphanumeric and im not sure how to turn this into 6 numeric digits

One approach is to choose an arbitrary 6 digit number to represent the password.

im not quite sure what you mean? i dont think there is another way of doing this, i have to calculate those 6 digit, I just dont know how to

First you need to know which protocol is being used. Hopefully it is one of the open standards.

[edit]

This one in particular:

Calculate? Do try to say: Create? Use the random function in the IDE, bang and/or twist it, and make characters...?

on the data that was given to me; it says type: TOTP. and the wiki link you sent has a see also about TOTP algorithm. is say there:

TOTP uses the HOTP algorithm, replacing the counter with a non-decreasing value based on the current time:

TOTP value(K) = HOTP value(K, CT),

calculating counter value

{isplaystyle C_{T}=eftfloor {rac {T-T_{0}}{T_{X}}}ightfloor ,}

but i dont see where the secret key would be used? isnt that weird?

That would be the HOTP part of the protocol.

You may want to try to get this working using a toolkit on your computer first before spending time trying to implement this on an Arduino.

Also, a quick search for TOTP Arduino gives some interesting results.

Thanks i think this is a good starting point, this seem to be more complicated than i thought.

My current goal is to basically create this function

unsigned int calculateOTP (String secretkey, unsigned long currentTime)

I think the Secret Key is 'K'.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.