Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- totp_generate() function - basic test for totp_generate() --FILE-- <?php $key = '..

Decoded Output download

--TEST--
totp_generate() function - basic test for totp_generate()
--FILE--
<?php
$key = '0123456789ABCDEF';

var_dump(is_numeric(totp_generate($key, 6, 30)));

var_dump(totp_generate('foobar', 6, 30));

var_dump(totp_generate($key, 3, 30));
var_dump(totp_generate($key, 20, 30));

?>
--EXPECTF--
bool(true)

Warning: OATH_INVALID_HEX: Hex string is invalid %s
bool(false)

Warning: OATH_INVALID_DIGITS: Unsupported number of OTP digits %s
bool(false)

Warning: OATH_INVALID_DIGITS: Unsupported number of OTP digits %s
bool(false)

Did this file decode correctly?

Original Code

--TEST--
totp_generate() function - basic test for totp_generate()
--FILE--
<?php
$key = '0123456789ABCDEF';

var_dump(is_numeric(totp_generate($key, 6, 30)));

var_dump(totp_generate('foobar', 6, 30));

var_dump(totp_generate($key, 3, 30));
var_dump(totp_generate($key, 20, 30));

?>
--EXPECTF--
bool(true)

Warning: OATH_INVALID_HEX: Hex string is invalid %s
bool(false)

Warning: OATH_INVALID_DIGITS: Unsupported number of OTP digits %s
bool(false)

Warning: OATH_INVALID_DIGITS: Unsupported number of OTP digits %s
bool(false)

Function Calls

totp_generate 1

Variables

$key 0123456789ABCDEF

Stats

MD5 bea0d6d58b95f80e08a5b415f82fd1f5
Eval Count 0
Decode Time 85 ms