codecamp

PHP8 sodium_crypto_stream

(PHP 7 >= 7.2.0, PHP 8)

sodium_crypto_stream — 从种子生成确定性的字节序列

说明

sodium_crypto_stream(int $length, string $nonce, string $key): string

使用 XSalsa20 流密码从种子生成确定性的字节序列。

参数 

length

要返回的字节数。

nonce

每封邮件只能使用一次的号码。长度为 24 个字节。 这是一个足够大的绑定,可以随机生成(即 random_bytes())。

key

加密密钥(256 位)。

返回值 

伪随机字节的字符串。


PHP8 sodium_crypto_stream_xor
PHP8 sodium_hex2bin
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定