PHP8 sodium_crypto_stream_xchacha20_xor

2024-03-19 10:46 更新

(PHP 8 >= 8.1.0)

sodium_crypto_stream_xchacha20_xor — 使用隨機數和密鑰加密消息(無身份驗證)

說明

sodium_crypto_stream_xchacha20_xor(string $message, string $nonce, string $key): string

使用 a 和 secret 加密(無身份驗證)。messagenoncekey

警告

此加密未經身份驗證,不會阻止所選密文攻擊。 確保將密文與消息驗證碼相結合, 例如,使用 sodium_crypto_aead_xchacha20poly1305_ietf_encrypt() 函數, 或 sodium_crypto_auth()。

參數 

message

要加密的消息。

nonce

24 字節(jié)隨機數。

key

鍵,可能從 sodium_crypto_stream_xchacha20_keygen() 生成。

返回值 

加密消息。

參見 

  • sodium_crypto_stream_xchacha20_xor_ic() - 使用隨機數和密鑰加密消息(無身份驗證)


以上內容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號