示例#1
0
 /**
  * Test generating random number with php openssl extension algorithm.
  *
  * @author Benjamin Carl <*****@*****.**>
  */
 public function testGeneratingRandomIntegerByOpenSsl()
 {
     $generator = new Generator(Generator::MODE_OPEN_SSL);
     $this->assertInternalType('int', $generator->generate());
 }
示例#2
0
 /**
  * Generates a token based on time and random input (salt).
  *
  * @author Benjamin Carl <*****@*****.**>
  *
  * @return string Generated token
  */
 public function generateToken()
 {
     // Generate token from unique input
     $generator = new RandomNumberGenerator();
     $time = microtime(true);
     $salt = $generator->generate();
     return sha1($time . $salt);
 }