(PHP 8 >= 8.1.0)
sodium_crypto_stream_xchacha20_xor — 使用 nonce 和密钥加密消息(无身份验证)
$message, string $nonce, #[\SensitiveParameter] string $key): string使用 nonce 和密钥 key 加密 message(无身份验证)。
此加密未经身份验证,无法防止选择密文攻击。请务必将密文与消息认证码结合使用,例如使用 sodium_crypto_aead_xchacha20poly1305_ietf_encrypt() 函数或 sodium_crypto_auth()。
message要加密的消息。
nonce24 字节的 nonce。
key密钥,可能由 sodium_crypto_stream_xchacha20_keygen() 生成。
加密后的消息。