change random string library because of deprecated code in old one

This commit is contained in:
2019-08-05 21:42:26 +02:00
parent 2fb7e63788
commit d20322867d
3 changed files with 29 additions and 4 deletions

View File

@ -0,0 +1,27 @@
<?php
namespace D3\Totp\Application\Model;
use Zend\Math\Rand;
class d3RandomGenerator extends Rand
{
const CHAR_UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
const CHAR_LOWER = 'abcdefghijklmnopqrstuvwxyz';
const CHAR_DIGITS = '0123456789';
const CHAR_UPPER_HEX = 'ABCDEF';
const CHAR_LOWER_HEX = 'abcdef';
const CHAR_BASE64 = '+/';
const CHAR_SYMBOLS = '!"#$%&\'()* +,-./:;<=>?@[\]^_`{|}~';
const CHAR_BRACKETS = '()[]{}<>';
const CHAR_PUNCT = ',.;:';
/**
* @return string
*/
public static function getRandomTotpBackupCode()
{
return self::getString(6, self::CHAR_DIGITS);
}
}