$ show jchambers/java-otp
java-otp is a Java library for generating HOTP (RFC 4226) and TOTP (RFC 6238) one-time passwords. The core functionality resides in two thread-safe classes: HmacOneTimePasswordGenerator for HMAC-based OTPs and TimeBasedOneTimePasswordGenerator for time-based OTPs. The library depends only on the Java standard library, with JUnit and JMH used solely for testing and benchmarking. Entry points include the constructors and methods like generateOneTimePassword and validateOneTimePassword. Data flow involves passing a SecretKey and counter/timestamp to generate or validate OTPs. The architecture is a simple, focused library with no external services or complex dependencies.
The LLM identified 1 files worth highlighting for reuse:
Implements the HOTP algorithm per RFC 4226 with proper dynamic truncation, leading-zero formatting, and constant-time validation to prevent timing attacks. The class is self-contained, depends only on Java standard library, and can be extracted for use in other projects with minimal changes (e.g., package renaming). Demonstrates strong cryptographic implementation skills and security awareness.