PHP8 sodium_crypto_core_ristretto255_random

2024-03-16 10:10 更新

(PHP 8 >= 8.1.0)

sodium_crypto_core_ristretto255_random — 生成隨機(jī)密鑰

說(shuō)明

sodium_crypto_core_ristretto255_random(): string

生成一個(gè)隨機(jī)鍵。 從 libsodium 1.0.18 開始可用。

警告

本函數(shù)還未編寫文檔,僅有參數(shù)列表。

參數(shù) 

此函數(shù)沒(méi)有參數(shù)。

返回值 

返回一個(gè) 32 字節(jié)的隨機(jī)字符串。

示例 

示例 #1 sodium_crypto_core_ristretto255_random() example

<?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));
?>

以上示例會(huì)輸出:

bool(true)

參見 

  • sodium_crypto_core_ristretto255_add() - 添加元素
  • sodium_crypto_core_ristretto255_sub() - 減去一個(gè)元素


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)