PHP Classes

TOTP: Generate and validate expirable one time passwords

Recommend this page to a friend!
  Info   Screenshots Screenshots   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 1,978 All time: 1,991 This week: 68Up
Version License PHP version Categories
timeonetimepassword 2.0GNU Lesser Genera...5.0PHP 5, Cryptography, User Management


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.

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
Picture of Protung Dragos
Name: Protung Dragos is available for providing paid consulting. Contact Protung Dragos .
Classes: 10 packages by
Country: Romania Romania
Age: 41
All time rank: 281 in Romania Romania
Week rank: 53 Down2 in Romania Romania Down
Innovation award
Innovation award
Nominee: 3x


___________________________________________________________ PHP Time One Time Password - Version 1.5a December 2009 ___________________________________________________________ Copyright (c) 2009 Dragos Protung _______________________ CONTENTS _______________________ 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 ;)

  • Example.jpg
  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

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:1,991
This week:68Up