codecamp

PHP8 sodium_crypto_core_ristretto255_scalar_negate

(PHP 8 >= 8.1.0)

sodium_crypto_core_ristretto255_scalar_negate — 否定标量值

说明

sodium_crypto_core_ristretto255_scalar_negate(string $s): string

否定标量值。 从 libsodium 1.0.18 开始可用。

警告

本函数还未编写文档,仅有参数列表。

参数 

s

标量值。

返回值

返回一个 32 字节的随机字符串。

示例 

示例 #1 sodium_crypto_core_ristretto255_scalar_negate() example

<?php

$foo = sodium_crypto_core_ristretto255_scalar_random();

$negate = sodium_crypto_core_ristretto255_scalar_negate($foo);
$reNegate = sodium_crypto_core_ristretto255_scalar_negate($negate);

var_dump(hash_equals($foo, $reNegate));
?>

以上示例会输出:

bool(true)

参见 

  • sodium_crypto_core_ristretto255_scalar_random() - 生成一个随机键


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