title: RFC4226 HOTP Java Implementation
body: <p>I tried to copy the HOTPAlgorithm.java codes (<a href="https://svn.forgerock.org/openam/tags/10.0.0-docs/products/amserver/source/com/sun/identity/authentication/modules/hotp/HOTPAlgorithm.java" rel="nofollow noreferrer">HOTPAlgorithm.java</a>) and compared it against the official HOTP RFC 4226's sample implementation (<a href="https://www.rfc-editor.org/rfc/rfc4226#page-27" rel="nofollow noreferrer">RFC4226 Page 27</a>) found on Page 27 of the official RFC4226 document. Both the HOTPAlgorithm.java and the implementation in the RFC4226 are written by the same author whom is Loren Hart and set to version 1.0. Both codes are the same essnetially from my comparison.</p>
  <p>I tried to run test vector for 6 digit HOTP codes (without modifying the HOTPAlgorithm.java script) and noticed that the source codes given in the RFC4226 and the HOTPAlgorithm.java produces different test vector results against the published RFC4226 results with exactly the same setting.</p>
  <p>Is there a discrepancy in the Java codes published by RFC4226 sample Java codes and the HOTPAlogrithm.java when compared against the RFC4226 test vectors ?</p>
  <p>Test Results from HOTPAlgorithm.java and RFC4226 Java codes (both produce the same results):</p>
  <pre><code>755224
  030356
  132975
  957805
  463120
  994243
  844697
  570244
  487336
  025740
  </code></pre>
  <p>Test Vectors from RFC4226 Publication (<a href="https://www.rfc-editor.org/rfc/rfc4226#page-32" rel="nofollow noreferrer">RFC4226 Page 32</a>)</p>
  <pre><code>755224
  287082
  359152
  969429
  338314
  254676
  287922
  162583
  399871
  520489
  </code></pre>
  <p>Am I missing something or is there discrepancies between officially published sample codes and officially published results ?</p>