Ejemplo n.º 1
0
 /**
  * Generate a random salt.
  * @return string Salt.
  */
 public function genSalt()
 {
     $bytes = Random::bytes($this->saltLength);
     $b64 = rtrim(base64_encode($bytes), '=');
     $salt = Binary::slice(str_replace('+', '.', $b64), 0, $this->saltLength);
     return $this->prefix . $salt;
 }