Exemplo n.º 1
0
 /**
  * Generate new salt
  *
  * @param string $secret
  *
  * @return $this
  */
 public function generateSalt($secret = '')
 {
     $data = ['rnd0' => Str::str_random(rand(16, 64)), 'time' => uniqid($secret), 'secret' => $secret, 'rnd1' => Str::str_random(rand(16, 64))];
     shuffle($data);
     $middleCode = base64_encode(json_encode($data));
     shuffle($data);
     $key = base64_encode(json_encode($data));
     $this->salt = md5($this->getUid()) . hash_hmac('sha256', $middleCode, $key);
     return $this;
 }
Exemplo n.º 2
0
 /**
  * Generate remember token
  *
  * @param string $uid
  *
  * @return string
  */
 public function generateRememberToken($uid = '')
 {
     $this->setRememberToken(md5(microtime() . $uid . Str::str_random()));
     return $this->getRememberToken();
 }