示例#1
0
 /**
  * Gets a new random unique session id.
  *
  * @return mixed
  */
 static function getNewSessionId()
 {
     do {
         $key = Random::getInstance()->get(64, Random::HEX);
         if (empty($key)) {
             return FALSE;
         }
     } while (Database::getInstance()->check('session', array('session_key' => $key)));
     return $key;
 }
示例#2
0
 /**
  * Get a new salt string.
  *
  * @return string
  *   A binary string of salt.
  */
 public static function getSalt()
 {
     return Random::getInstance()->get(32, Random::BIN);
 }