[Plugin] TOTP Plugin
#15

Quote:
Originally Posted by MerryDeer
View Post
How to generate right secret keys?
Secret key generator (base32):

PHP Code:
<?php
//by PHPGangsta
function _getBase32LookupTable()
{
    return array(
        
'A''B''C''D''E''F''G''H'//  7
        
'I''J''K''L''M''N''O''P'// 15
        
'Q''R''S''T''U''V''W''X'// 23
        
'Y''Z''2''3''4''5''6''7'// 31
        
'='  // padding char
    
);
}
function 
createSecret($secretLength 16)
{
    
$validChars _getBase32LookupTable();
    unset(
$validChars[32]);
    
$secret '';
    for (
$i 0$i $secretLength$i++) {
        
$secret .= $validChars[array_rand($validChars)];
    }
    return 
$secret;
}
echo 
createSecret();
?>
Reply


Messages In This Thread
TOTP Plugin - by Igorek - 07.01.2016, 14:02
Re: TOTP Plugin - by Neutralneu - 07.01.2016, 14:05
Re: TOTP Plugin - by Elegy - 07.01.2016, 14:52
Re: TOTP Plugin - by Vince - 07.01.2016, 15:05
Re: TOTP Plugin - by ikkentim - 07.01.2016, 19:12
Re: TOTP Plugin - by Mauzen - 07.01.2016, 21:11
Re: TOTP Plugin - by Igorek - 08.01.2016, 15:19
Re: TOTP Plugin - by MerryDeer - 23.08.2016, 04:51
Re: TOTP Plugin - by JaydenJason - 23.08.2016, 11:45
Re: TOTP Plugin - by Scranton - 23.08.2016, 13:16
Re: TOTP Plugin - by JaydenJason - 23.08.2016, 14:40
Re: TOTP Plugin - by izeatfishz - 23.08.2016, 21:18
Re: TOTP Plugin - by Scranton - 24.08.2016, 08:24
Re: TOTP Plugin - by MerryDeer - 24.08.2016, 11:17
Re: TOTP Plugin - by Igorek - 28.08.2016, 16:16
Re: TOTP Plugin - by MerryDeer - 28.08.2016, 16:57
Re: TOTP Plugin - by JaydenJason - 30.08.2016, 14:22
Re: TOTP Plugin - by Igorek - 28.09.2017, 07:21
Re: TOTP Plugin - by Crystallize - 28.09.2017, 14:13
Re: TOTP Plugin - by DeepCode - 30.11.2017, 13:11
Re: TOTP Plugin - by ZiGGi - 30.11.2017, 15:09
Re: TOTP Plugin - by DeepCode - 01.12.2017, 20:28
Re: TOTP Plugin - by Igorek - 02.12.2017, 10:55
Re: TOTP Plugin - by DeepCode - 04.12.2017, 14:18

Forum Jump:


Users browsing this thread: 1 Guest(s)