PHP Classes

TOTP: Generate and validate expirable one time passwords

Recommend this page to a friend!

  Author Author  
Picture of Protung Dragos
Name: Protung Dragos is available for providing paid consulting. Contact Protung Dragos .
Classes: 10 packages by
Country: Romania Romania
Age: 39
All time rank: 281 in Romania Romania
Week rank: 27 Up1 in Romania Romania Equal
Innovation award
Innovation award
Nominee: 3x

  Detailed description   Download Download .zip .tar.gz   Install with Composer Install with Composer  
This class can be used to generate and validate one time passwords that may expire after a period of time (without using a database or saving the password of any kind).

It generates a code based on a secret key that is valid during a period of time.

The class can also be used to validate the generated code in a different server and check if the code expired.


                PHP Time One Time Password - Version 1.5a
                             December 2009

                Copyright (c) 2009 Dragos Protung



1. Description
2. System Requirements
3. How to use
4. Contact


1. Product Description

A PHP class that can generate a code valid for a limited time.
Based on a secret key you can generate a code that is valid only for a limited period of time
or as a one time password (OTP), so this class extends the OTP to support the valability of the code in time.
The password generated can be verified on another server (or the same) without sending the secret key
and it will be valid only for a limited time.
The encription is using is the HMAC algorithm.

It can be usefull to grant access for a limited time to a resource without saving the passwords and it's valability
and check of it's valability.

2. System Requirements

PHP 5.x
For PHP version prior to 5.1.2 use totp_p512.class.php


3. How to use

See the example file (example.php)


4. Contact

Please send your suggestions, bug reports and general feedback to
Also visit

Out for now ;)

  Classes of Protung Dragos  >  TOTP  >  Download Download .zip .tar.gz  >  Support forum Support forum (2)  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: TOTP
Base name: timeonetimepassword
Description: Generate and validate expirable one time passwords
Version: 2.0
PHP version: 5.0
License: GNU Lesser General Public License (LGPL)
All time users: 1960 users
All time rank: 1999
Week users: 0 users
Week rank: 179 Equal
  Groups   Screenshots Screenshots   Rate classes User ratings   Applications   Files Files  

Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Cryptography Encrypting, decrypting and hashing data View top rated classes
Group folder image User Management User records, authentication and session handling View top rated classes

  Files folder image Screenshots  
File Role Description
Accessible without login Image file Example.jpg Screen example

  Innovation Award  
PHP Programming Innovation award nominee
July 2008
Number 6

Prize: One book of choice from Manning
One time passwords are useful to provide authorization to access restricted resources during a single access.

This class enhances the concept of one time passwords by giving a single access to the resources for a limited period of time.

Manuel Lemos

  User ratings  
Not enough user ratings

  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  Files folder image Files  
File Role Description
Plain text file example.php Example Example script
Plain text file license.txt Lic. License
Plain text file readme.txt Doc. Readme file
Plain text file totp.class.php Class Main class
Plain text file totp_p512.class.php Class Class for PHP < 5.1.2

Install with Composer Install with Composer - Download Download all files: timeonetimepassword.tar.gz
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
For more information send a message to info at phpclasses dot org.