array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'function.sodium-crypto-core-ristretto255-random.php', 1 => 'sodium_crypto_core_ristretto255_random', ), 'up' => array ( 0 => 'ref.sodium.php', 1 => 'Sodium 関数', ), 'prev' => array ( 0 => 'function.sodium-crypto-core-ristretto255-is-valid-point.php', 1 => 'sodium_crypto_core_ristretto255_is_valid_point', ), 'next' => array ( 0 => 'function.sodium-crypto-core-ristretto255-scalar-add.php', 1 => 'sodium_crypto_core_ristretto255_scalar_add', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/sodium/functions/sodium-crypto-core-ristretto255-random.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 8 >= 8.1.0)
sodium_crypto_core_ristretto255_random — ランダムな鍵を生成する
ランダムな鍵を生成します。 libsodium 1.0.18 以降で利用可能です。
この関数は、 現在のところ詳細な情報はありません。引数のリストのみが 記述されています。
この関数にはパラメータはありません。
32バイト長のランダムな文字列を返します。
例1 sodium_crypto_core_ristretto255_random() の例
<?php
$foo = sodium_crypto_core_ristretto255_random();
$bar = sodium_crypto_core_ristretto255_random();
$value = sodium_crypto_core_ristretto255_add($foo, $bar);
$value = sodium_crypto_core_ristretto255_sub($value, $bar);
var_dump(hash_equals($foo, $value));
?>
上の例の出力は以下となります。
bool(true)