crypt error for file link -


im trying create file sharing website im begginer @ php string

$_file['file_short_url']        = substr( preg_replace( "/[^a-za-z0-9]/", '', crypt( $_file['file_key'] ) ), 0, 5 ); 

and gives me error notice: crypt(): no salt parameter specified. must use randomly generated salt , strong hash function produce secure hash idk im doing wrong can me pls thank you

you don't need salt, if want avoid notice:

$_file['file_short_url'] = substr( preg_replace( "/[^a-za-z0-9]/", crypt( $_file['file_key'], 'my_secret_salt') ), 0, 5 );

what doing here? why preg_replacing?