CakeFest 2024: The Official CakePHP Conference

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ビット)

戻り値

擬似ランダムなバイト列を文字列として返します。

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top