Ejemplo n.º 1
0
 /**
  * Generates a salt of specified length. The salt consists of characters in the set [./0-9A-Za-z].
  *
  * @param   integer  $length  The number of characters to return.
  *
  * @return  string  The string of random characters.
  *
  * @since   12.2
  */
 protected function getSalt($length)
 {
     $bytes = ceil($length * 6 / 8);
     $randomData = str_replace('+', '.', base64_encode(JCrypt::getRandomBytes($bytes)));
     return substr($randomData, 0, $length);
 }