Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thecodedrift/hotp-php
HMAC Based One Time Passwords in PHP. RFC4226 and RFC6238 compliant.
https://github.com/thecodedrift/hotp-php
hotp hotp-generator otp php totp
Last synced: 20 days ago
JSON representation
HMAC Based One Time Passwords in PHP. RFC4226 and RFC6238 compliant.
- Host: GitHub
- URL: https://github.com/thecodedrift/hotp-php
- Owner: thecodedrift
- License: other
- Created: 2011-01-13T00:45:15.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2022-08-14T22:35:44.000Z (over 2 years ago)
- Last Synced: 2025-01-02T21:12:05.195Z (24 days ago)
- Topics: hotp, hotp-generator, otp, php, totp
- Language: PHP
- Homepage:
- Size: 39.1 KB
- Stars: 51
- Watchers: 4
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
HOTP - PHP Based HMAC One Time Passwords
========================================**What is HOTP**:
HOTP is a class that simplifies One Time Password systems for PHP Authentication. The HOTP/TOTP Algorithms have been around for a bit, so this is a straightforward class to meet the test vector requirements.**What works with HOTP/TOTP**:
It's been tested to the test vectors, and I've verified the time-sync hashes against the following:* Android: Mobile-OTP
* iPhone: OATH Token**Why would I use this**:
Who wouldn't love a simple drop-in class for HMAC Based One Time Passwords? It's a great extra layer of security (creating two-factor auth) and it's pretty darn zippy.**Okay you sold me. Give me some docs**:
```php
use jakobo\HOTP\HOTP;// event based
$result = HOTP::generateByCounter( $key, $counter );// time based within a "window" of time
$result = HOTP::generateByTime( $key, $window );// same as generateByTime, but for $min windows before and $max windows after
$result = HOTP::generateByTimeWindow( $key, $window, $min, $max );
```with `$result`, you can do all sorts of neat things...
```php
$result->toString();$result->toHex();
$result->toDec();
// how many digits in your OTP?
$result->toHotp( $length );
```