Hello, i want to create a OTP generator event based (the event is a button) and see the OTP on a LED Dipslay 4 Digits.
I want to use this library for generate the OTP:
but i don't understand the command to use this:
hash = Sha1.result();
And I'm note sure but How can give here the number (seed) to start the generation?
The 'seed' (value being hashed with SHA1) is calculated from the shared key and the 8-byte counter. See the specification: RFC 4226 - HOTP: An HMAC-Based One-Time Password Algorithm
Thank you for the link.
But i forgotten to specify that i create a seed by a dip-switch (8 bit) that i save in array.
SHA1 is a hashing algorithm, not a pseudo random number generator. It doesn't use a "seed".
If your "shared secret key" is only 8 bits it will be trivial to brute-force. Your shared key should be more like 8 or 16 bytes (64 or 128 bits).