在php中,mcrypt_decrypt()函數(shù)用于使用給定參數(shù)解密密文,語法“mcrypt_decrypt($cipher,$key,$data,$mode,$iv)”;參數(shù)“$key”是數(shù)據(jù)加密密鑰,“$data”是使用給定的“$cipher”和“$mode”解密的數(shù)據(jù)。
本教程操作環(huán)境:windows7系統(tǒng)、PHP8版、DELL G3電腦
php mcrypt_decrypt()函數(shù)
mcrypt_decrypt — 使用給定參數(shù)解密密文,語法格式:
mcrypt_decrypt( string $cipher, string $key, string $data, string $mode, string $iv = ? ): string|false
登錄后復(fù)制
可以解密 data 并返回明文。
參數(shù):
-
cipher
MCRYPT_ciphername 常量中的一個(gè),或者是字符串值的算法名稱。
-
key
數(shù)據(jù)加密密鑰。 如果密鑰長(zhǎng)度不是加解密算法能夠支持的有效長(zhǎng)度, 那么會(huì)產(chǎn)生警告并且返回 false
-
data
要使用給定的 cipher 和 mode 解密的數(shù)據(jù)。 如果數(shù)據(jù)大小不是 n * 分組大小,則在其后追加 '