src/Auth/Password.php
public static function blowfishSalt( $cost = 8 ) {
		// encoding algorithm from http://www.openwall.com/phpass/
		$itoa = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
		if ( $cost < 4 || $cost > 31 ) {
			$cost = 8;
		}
		$random = self::getBytes( 16 );

		$output = self::BLOWFISH_PREFIX;
		$output .= chr( ord( '0' ) + $cost / 10 );
		$output .= chr( ord( '0' ) + $cost % 10 );
		$output .= '$';

		$i = 0;
		do {
			$c1 = ord( $random[$i++] );
			$output .= $itoa[$c1 >> 2];
			$c1 = ( $c1 & 0x03 ) << 4;
			if ( $i >= 16 ) {
				$output .= $itoa[$c1];
				break;
			}

			$c2 = ord( $random[$i++] );
			$c1 |= $c2 >> 4;
			$output .= $itoa[$c1];
			$c1 = ( $c2 & 0x0f ) << 2;

			$c2 = ord( $random[$i++] );
			$c1 |= $c2 >> 6;
			$output .= $itoa[$c1];
			$output .= $itoa[$c2 & 0x3f];
		} while ( 1 );

		return $output;
	}
public static function blowfishSalt( $cost = 8 ) {
		// encoding algorithm from http://www.openwall.com/phpass/
		$itoa = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
		if ( $cost < 4 || $cost > 31 ) {
			$cost = 8;
		}
		$random = self::getBytes( 16 );

		$output = self::BLOWFISH_PREFIX;
		$output .= chr( ord( '0' ) + $cost / 10 );
		$output .= chr( ord( '0' ) + $cost % 10 );
		$output .= '$';

		$i = 0;
		do {
			$c1 = ord( $random[$i++] );
			$output .= $itoa[$c1 >> 2];
			$c1 = ( $c1 & 0x03 ) << 4;
			if ( $i >= 16 ) {
				$output .= $itoa[$c1];
				break;
			}

			$c2 = ord( $random[$i++] );
			$c1 |= $c2 >> 4;
			$output .= $itoa[$c1];
			$c1 = ( $c2 & 0x0f ) << 2;

			$c2 = ord( $random[$i++] );
			$c1 |= $c2 >> 6;
			$output .= $itoa[$c1];
			$output .= $itoa[$c2 & 0x3f];
		} while ( 1 );

		return $output;
	}
public static function blowfishSalt ( $ cost = 8 ) { // encoding algorithm from http://www.openwall.com/phpass/ $ itoa = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' ; if ( $ cost < 4 || $ cost > 31 ) { $ cost = 8 ; } $ random = self :: getBytes ( 16 ) ; $ output = self :: BLOWFISH_PREFIX ; $ output .= chr ( ord ( '0' ) + $ cost / 10 ) ; $ output .= chr ( ord ( '0' ) + $ cost % 10 ) ; $ output .= '$' ; $ i = 0 ; do { $ c1 = ord ( $ random [ $ i ++ ] ) ; $ output .= $ itoa [ $ c1 >> 2 ] ; $ c1 = ( $ c1 & 0x03 ) << 4 ; if ( $ i >= 16 ) { $ output .= $ itoa [ $ c1 ] ; break ; } $ c2 = ord ( $ random [ $ i ++ ] ) ; $ c1 |= $ c2 >> 4 ; $ output .= $ itoa [ $ c1 ] ; $ c1 = ( $ c2 & 0x0f ) << 2 ; $ c2 = ord ( $ random [ $ i ++ ] ) ; $ c1 |= $ c2 >> 6 ; $ output .= $ itoa [ $ c1 ] ; $ output .= $ itoa [ $ c2 & 0x3f ] ; } while ( 1 ) ; return $ output ; }
Generate a blowfish salt specification.

@param int $cost Cost factor
@return string Blowfish salt
Generate a blowfish salt specification .