I have written code to generate a 6 digit HOTP value every time a fuction is called. I created this since I want to learn how I can create something by reading a document and experiment with it. I used RFC4226 document as my requirements to achieve my task of generating OTP based on input, counter, Output size and the HMAC-SHA-1 algorithm.
The code works and it returns with a 6 digit OTP everytime the counter is increased. But the problem I do not understand is I tested my code with the test parameters provided in page:31 of RFC4226 document (Link I provided above paragraph). The vaues I get are not as same in that document, But I think I have followed everything mentioned in the document because I cannot seem to find where my mistake is. I know there are libraries to generate HOTP values but I wanted to experiment and learn how to build them myself.
It would be really helpful if anyone can help me o on this and let me know what do I need to do or where am I doing wrong