ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
加密扩展 mcrypt 在 PHP 7.2 中已经移除,从PHP 7.2.0开始,libsodium扩展与PHP捆绑在一起。对于较旧的PHP版本,可以通过PECL[https://pecl.php.net/package/libsodium](https://pecl.php.net/package/libsodium)获得此扩展。 Sodium:一个提供加密、解密、签名等功能的软件库 * [预定义常量](https://www.php.net/manual/en/sodium.constants.php) * [sodium函数](https://www.php.net/manual/en/ref.sodium.php) * [sodium_add](https://www.php.net/manual/en/function.sodium-add.php)—[加大](https://www.php.net/manual/en/function.sodium-add.php)数 * [sodium_base642bin](https://www.php.net/manual/en/function.sodium-base642bin.php)—说明 * [sodium_bin2base64](https://www.php.net/manual/en/function.sodium-bin2base64.php)—说明 * [sodium_bin2hex](https://www.php.net/manual/en/function.sodium-bin2hex.php)—编码为十六进制 * [sodium_compare](https://www.php.net/manual/en/function.sodium-compare.php)—比较大数 * [sodium_crypto_aead_aes256gcm_decrypt](https://www.php.net/manual/en/function.sodium-crypto-aead-aes256gcm-decrypt.php)—在组合模式下通过预先计算进行解密 * [sodium_crypto_aead_aes256gcm_encrypt](https://www.php.net/manual/en/function.sodium-crypto-aead-aes256gcm-encrypt.php)—结合结合使用预先计算的模式进行加密 * [sodium_crypto_aead_aes256gcm_is_available](https://www.php.net/manual/en/function.sodium-crypto-aead-aes256gcm-is-available.php)—检查硬件是否支持AES256-GCM * [sodium_crypto_aead_aes256gcm_keygen](https://www.php.net/manual/en/function.sodium-crypto-aead-aes256gcm-keygen.php)—获取密钥的随机字节 * [sodium_crypto_aead_chacha20poly1305_decrypt](https://www.php.net/manual/en/function.sodium-crypto-aead-chacha20poly1305-decrypt.php)—验证密文是否包含有效标签 * [sodium_crypto_aead_chacha20poly1305_encrypt](https://www.php.net/manual/en/function.sodium-crypto-aead-chacha20poly1305-encrypt.php)—加密消息 * [sodium_crypto_aead_chacha20poly1305_ietf_decrypt](https://www.php.net/manual/en/function.sodium-crypto-aead-chacha20poly1305-ietf-decrypt.php)—验证密文是否包含有效标签 * [sodium_crypto_aead_chacha20poly1305_ietf_encrypt](https://www.php.net/manual/en/function.sodium-crypto-aead-chacha20poly1305-ietf-encrypt.php)—加密消息 * [sodium_crypto_aead_chacha20poly1305_ietf_keygen](https://www.php.net/manual/en/function.sodium-crypto-aead-chacha20poly1305-ietf-keygen.php)—获取密钥的随机字节 * [sodium_crypto_aead_chacha20poly1305_keygen](https://www.php.net/manual/en/function.sodium-crypto-aead-chacha20poly1305-keygen.php)—获取密钥的随机字节 * [sodium_crypto_aead_xchacha20poly1305_ietf_decrypt](https://www.php.net/manual/en/function.sodium-crypto-aead-xchacha20poly1305-ietf-decrypt.php)—说明 * [sodium_crypto_aead_xchacha20poly1305_ietf_encrypt](https://www.php.net/manual/en/function.sodium-crypto-aead-xchacha20poly1305-ietf-encrypt.php)—说明 * [sodium_crypto_aead_xchacha20poly1305_ietf_keygen](https://www.php.net/manual/en/function.sodium-crypto-aead-xchacha20poly1305-ietf-keygen.php)—说明 * [sodium_crypto_auth_keygen](https://www.php.net/manual/en/function.sodium-crypto-auth-keygen.php)—获取密钥的随机字节 * [sodium_crypto_auth_verify](https://www.php.net/manual/en/function.sodium-crypto-auth-verify.php)—验证标签对消息有效 * [sodium_crypto_auth](https://www.php.net/manual/en/function.sodium-crypto-auth.php)—计算消息的标签 * [sodium_crypto_box_keypair_from_secretkey_and_publickey](https://www.php.net/manual/en/function.sodium-crypto-box-keypair-from-secretkey-and-publickey.php)—说明 * [sodium_crypto_box_keypair](https://www.php.net/manual/en/function.sodium-crypto-box-keypair.php)—随机生成一个秘密密钥和一个对应的公共密钥 * [sodium_crypto_box_open](https://www.php.net/manual/en/function.sodium-crypto-box-open.php)—验证[和解密密](https://www.php.net/manual/en/function.sodium-crypto-box-open.php)文 * [sodium_crypto_box_publickey_from_secretkey](https://www.php.net/manual/en/function.sodium-crypto-box-publickey-from-secretkey.php)—说明 * [sodium_crypto_box_publickey-](https://www.php.net/manual/en/function.sodium-crypto-box-publickey.php)说明 * [sodium_crypto_box_seal_open](https://www.php.net/manual/en/function.sodium-crypto-box-seal-open.php)—解密密文 * [sodium_crypto_box_seal](https://www.php.net/manual/en/function.sodium-crypto-box-seal.php)—加密消息 * [sodium_crypto_box_secretkey](https://www.php.net/manual/en/function.sodium-crypto-box-secretkey.php)—说明 * [sodium_crypto_box_seed_keypair](https://www.php.net/manual/en/function.sodium-crypto-box-seed-keypair.php)—确定性地从单个密钥导出密钥对 * [sodium_crypto_box](https://www.php.net/manual/en/function.sodium-crypto-box.php)—加密消息 * [sodium_crypto_generichash_final](https://www.php.net/manual/en/function.sodium-crypto-generichash-final.php)—完成哈希 * [sodium_crypto_generichash_init](https://www.php.net/manual/en/function.sodium-crypto-generichash-init.php)—初始化哈希 * [sodium_crypto_generichash_keygen](https://www.php.net/manual/en/function.sodium-crypto-generichash-keygen.php)—获取密钥的随机字节 * [sodium_crypto_generichash_update](https://www.php.net/manual/en/function.sodium-crypto-generichash-update.php)—将消息添加到哈希 * [sodium_crypto_generichash](https://www.php.net/manual/en/function.sodium-crypto-generichash.php)—获取消息的哈希值 * [sodium_crypto_kdf_derive_from_key](https://www.php.net/manual/en/function.sodium-crypto-kdf-derive-from-key.php)—派生一个子项 * [sodium_crypto_kdf_keygen](https://www.php.net/manual/en/function.sodium-crypto-kdf-keygen.php)—获取密钥的随机字节 * [sodium_crypto_kx_client_session_keys](https://www.php.net/manual/en/function.sodium-crypto-kx-client-session-keys.php)—说明 * [sodium_crypto_kx_keypair](https://www.php.net/manual/en/function.sodium-crypto-kx-keypair.php)—创建一个新的sodium密钥对 * [sodium_crypto_kx_publickey](https://www.php.net/manual/en/function.sodium-crypto-kx-publickey.php)—说明 * [sodium_crypto_kx_secretkey](https://www.php.net/manual/en/function.sodium-crypto-kx-secretkey.php)—说明 * [sodium_crypto_kx_seed_keypair](https://www.php.net/manual/en/function.sodium-crypto-kx-seed-keypair.php)—说明 * [sodium_crypto_kx_server_session_keys](https://www.php.net/manual/en/function.sodium-crypto-kx-server-session-keys.php)—说明 * [sodium_crypto_pwhash_scryptsalsa208sha256_str_verify](https://www.php.net/manual/en/function.sodium-crypto-pwhash-scryptsalsa208sha256-str-verify.php)—验证密码是否为有效的密码验证字符串 * [sodium_crypto_pwhash_scryptsalsa208sha256_str](https://www.php.net/manual/en/function.sodium-crypto-pwhash-scryptsalsa208sha256-str.php)—获取ASCII编码的哈希 * [sodium_crypto_pwhash_scryptsalsa208sha256](https://www.php.net/manual/en/function.sodium-crypto-pwhash-scryptsalsa208sha256.php)—从密码[派生](https://www.php.net/manual/en/function.sodium-crypto-pwhash-scryptsalsa208sha256.php)密钥 * [sodium_crypto_pwhash_str_needs_rehash](https://www.php.net/manual/en/function.sodium-crypto-pwhash-str-needs-rehash.php)—说明 * [sodium_crypto_pwhash_str_verify](https://www.php.net/manual/en/function.sodium-crypto-pwhash-str-verify.php)—验证密码是否匹配哈希 * [sodium_crypto_pwhash_str](https://www.php.net/manual/en/function.sodium-crypto-pwhash-str.php)—获取ASCII编码的哈希 * [sodium_crypto_pwhash](https://www.php.net/manual/en/function.sodium-crypto-pwhash.php)—从密码派生密钥 * [sodium_crypto_scalarmult_base](https://www.php.net/manual/en/function.sodium-crypto-scalarmult-base.php)—[sodium_crypto_box_publickey_from_secretkey的](https://www.php.net/manual/en/function.sodium-crypto-scalarmult-base.php)别名 * [sodium_crypto_scalarmult](https://www.php.net/manual/en/function.sodium-crypto-scalarmult.php)—给定用户的密钥和另一个用户的公共密钥,计算共享密钥 * [sodium_crypto_secretbox_keygen](https://www.php.net/manual/en/function.sodium-crypto-secretbox-keygen.php)—获取密钥的随机字节 * [sodium_crypto_secretbox_open](https://www.php.net/manual/en/function.sodium-crypto-secretbox-open.php)—验证[和解密密](https://www.php.net/manual/en/function.sodium-crypto-secretbox-open.php)文 * [sodium_crypto_secretbox](https://www.php.net/manual/en/function.sodium-crypto-secretbox.php)—加密消息 * [sodium_crypto_secretstream_xchacha20poly1305_init_pull](https://www.php.net/manual/en/function.sodium-crypto-secretstream-xchacha20poly1305-init-pull.php)—说明 * [sodium_crypto_secretstream_xchacha20poly1305_init_push](https://www.php.net/manual/en/function.sodium-crypto-secretstream-xchacha20poly1305-init-push.php)—说明 * [sodium_crypto_secretstream_xchacha20poly1305_keygen](https://www.php.net/manual/en/function.sodium-crypto-secretstream-xchacha20poly1305-keygen.php)—说明 * [sodium_crypto_secretstream_xchacha20poly1305_pull](https://www.php.net/manual/en/function.sodium-crypto-secretstream-xchacha20poly1305-pull.php)—说明 * [sodium_crypto_secretstream_xchacha20poly1305_push](https://www.php.net/manual/en/function.sodium-crypto-secretstream-xchacha20poly1305-push.php)—说明 * [sodium_crypto_secretstream_xchacha20poly1305_rekey](https://www.php.net/manual/en/function.sodium-crypto-secretstream-xchacha20poly1305-rekey.php)—说明 * [sodium_crypto_shorthash_keygen](https://www.php.net/manual/en/function.sodium-crypto-shorthash-keygen.php)—获取密钥的随机字节 * [sodium_crypto_shorthash](https://www.php.net/manual/en/function.sodium-crypto-shorthash.php)—计算消息的固定大小的指纹 * [sodium_crypto_sign_detached](https://www.php.net/manual/en/function.sodium-crypto-sign-detached.php)—对消息签名 * [sodium_crypto_sign_ed25519_pk_to_curve25519](https://www.php.net/manual/en/function.sodium-crypto-sign-ed25519-pk-to-curve25519.php)—将Ed25519公钥转换为Curve25519公钥 * [sodium_crypto_sign_ed25519_sk_to_curve25519](https://www.php.net/manual/en/function.sodium-crypto-sign-ed25519-sk-to-curve25519.php)—将Ed25519秘密密钥转换为Curve25519秘密密钥 * [sodium_crypto_sign_keypair_from_secretkey_and_publickey](https://www.php.net/manual/en/function.sodium-crypto-sign-keypair-from-secretkey-and-publickey.php)—说明 * [sodium_crypto_sign_keypair](https://www.php.net/manual/en/function.sodium-crypto-sign-keypair.php)—随机生成一个秘密密钥和一个对应的公共密钥 * [sodium_crypto_sign_open](https://www.php.net/manual/en/function.sodium-crypto-sign-open.php)—检查已签名的消息是否具有有效的签名 * [sodium_crypto_sign_publickey_from_secretkey](https://www.php.net/manual/en/function.sodium-crypto-sign-publickey-from-secretkey.php)—从[私钥中](https://www.php.net/manual/en/function.sodium-crypto-sign-publickey-from-secretkey.php)提取公钥 * [sodium_crypto_sign_publickey](https://www.php.net/manual/en/function.sodium-crypto-sign-publickey.php)—说明 * [sodium_crypto_sign_secretkey](https://www.php.net/manual/en/function.sodium-crypto-sign-secretkey.php)—说明 * [sodium_crypto_sign_seed_keypair](https://www.php.net/manual/en/function.sodium-crypto-sign-seed-keypair.php)—从单个密钥确定性地导出密钥对 * [sodium_crypto_sign_verify_detached](https://www.php.net/manual/en/function.sodium-crypto-sign-verify-detached.php)—验证消息的签名 * [sodium_crypto_sign](https://www.php.net/manual/en/function.sodium-crypto-sign.php)—签名消息 * [sodium_crypto_stream_keygen](https://www.php.net/manual/en/function.sodium-crypto-stream-keygen.php)—获取密钥的随机字节 * [sodium_crypto_stream_xor](https://www.php.net/manual/en/function.sodium-crypto-stream-xor.php)—加密消息 * [sodium_crypto_stream](https://www.php.net/manual/en/function.sodium-crypto-stream.php)—从种子生成确定的字节序列 * [sodium_hex2bin](https://www.php.net/manual/en/function.sodium-hex2bin.php)—解码十六进制编码的二进制字符串 * [sodium_increment](https://www.php.net/manual/en/function.sodium-increment.php)—增加数量 * [sodium_memcmp](https://www.php.net/manual/en/function.sodium-memcmp.php)—恒定时间测试相等性 * [sodium_memzero](https://www.php.net/manual/en/function.sodium-memzero.php)—用零覆盖buf * [sodium_pad](https://www.php.net/manual/en/function.sodium-pad.php)—添加填充数据 * [sodium_unpad](https://www.php.net/manual/en/function.sodium-unpad.php)—删除填充数据