Ejemplo n.º 1
0
 function __construct($callback = null, $ttl = -1)
 {
     //Maximum entropy, minimum data
     $this->id = \Radical\Basic\String\Random::GenerateBase64(6) . dechex(crc32(session_id() . time()));
     $len = strlen($this->id) - rand(0, 4);
     $this->id = substr($this->id, 0, $len);
     $this->key = \Radical\Basic\String\Random::GenerateBytes(32);
     $this->callback = $callback;
     if ($ttl > 0) {
         $this->expires = $ttl + time();
     }
     KeyStorage::AddKey($this);
 }
Ejemplo n.º 2
0
 /**
  * Generates an MD5 salt for use in `lithium\security\Password::hash()`.
  *
  * @return string The MD5 salt.
  */
 protected static function _genSaltMD5()
 {
     return '$1$' . String\Random::GenerateBase64(6);
 }