Ohhh, that's a really clever use of a calculator (unfortunately not a model I have). I'd love to pull out my TI-84 for 2fa; maybe that'll be a fun project for me
How large does the binary come out to be?
EDIT: I see the 18 KB release now.
I'm not very familiar with programming on the z80 calculators, but I can say some things about this.
You would need to be able to do these on the calculator:
- Take the SHA1 hash for binary data as large as 64 bytes.
- Get the current time
- Read in secret keys from user input
- Store small secret keys in RAM or flash (likely as a variable)
- Display codes on the screen
I imagine that that first one will be the most difficult. You would need to use assembly language (I don't think that there is a C compiler for the Ti84 Plus, and basic is far too slow, although there is a C compiler for the color calculators). I also can't find any implementations of SHA1 in z80 assembly, so you may have to make one on your own.
From what I can remember, the Ti84 has a built in clock, the Ti83 does not. You would need to figure out if there is a particular ROM call that you can use to get the time. If not, maybe it is stored at some memory address.
If after considering all of this, you are still confident that you can write this, then you should read these specifications so you know exactly what it is that you are implementing:
- RFC 2104 HMAC: Keyed-Hashing for Message Authentication
- RFC 4226 HOTP: An HMAC-Based One-Time Password Algorithm
- RFC 6228 TOTP: Time-Based One-Time Password Algorithm
- RFC 4648 The Base16, Base32, and Base64 Data Encodings (Base32 is used to convert user input into binary secret keys)
You could also read the code that I have written, or that of some smartphone authenticator app.