RAA - hotp

hotp / 1.0.0

Short description: Implements HOTP(RFC 4226) using Ruby.
Category: Library/Cryptography
Status: Beta
Created: 2007-10-26 01:41:52 GMT
Last update: 2007-10-26 01:41:52 GMT
Owner: Stephen Becker IV (Projects of this owner)
Homepage: http://rubyforge.org/projects/hotp/
Download: http://rubyforge.org/frs/?group_id=4715
License: BSD
Dependency:
None
Description:

HOTP — HMAC-Based One-Time Password Algorithm

  * HOTP: Implements RFC 4226 using Ruby. (http://www.ietf.org/rfc/rfc4226.txt)  HOTP is an HMAC-SHA1 based algorithm

Usage, …

HOTP

The HOTP object can be used to calculate the HOTP value for any secret and count. The number of digits in the HOTP value is determined by an optional parameter. The default HOTP value is 6 digits long.

Creating an HOTP instance

        h = HOTP.new()
        h.secret="12345678901234567890" # 20 byte key
        h.count=0                       # Where to start calculating
        h.digits=6                      # How many digits to return (length of the HOTP value)
        puts(h.hotp)                    # => "755224"
        h.count=1                       # Change the count
        puts(h.update)                  # => "287082"

Using HOTP as a class method

        secret = "12345678901234567890"
        count = 0
        puts(HOTP::hotp(secret,count))  # => "755224"

Edit this project (for project owner)

back to RAA top