PHP8 sodium_crypto_core_ristretto255_from_hash

2024-03-16 10:10 更新

(PHP 8 >= 8.1.0)

sodium_crypto_core_ristretto255_from_hash — 映射向量

說明

sodium_crypto_core_ristretto255_from_hash(string $s): string

將 64 字節(jié)的向量映射到組元素。 從 libsodium 1.0.18 開始可用。s

警告

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

參數(shù) 

s

一個 64 字節(jié)的向量。

返回值 ?

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

示例 

示例 #1 sodium_crypto_core_ristretto255_from_hash() example

<?php

$hashes = sodium_hex2bin(
    '5d1be09e3d0c82fc538112490e35701979d99e06ca3e2b5b54bffe8b4dc772c1' .
    '4d98b696a1bbfb5ca32c436cc61c16563790306c79eaca7705668b47dffe5bb6'
);
var_dump(sodium_bin2hex(sodium_crypto_core_ristretto255_from_hash($hashes)));
?>

以上示例會輸出:

string(64) "3066f82a1a747d45120d1740f14358531a8f04bbffe6a819f86dfe50f44a0a46"

參見 

  • sodium_hex2bin() - 解碼十六進(jìn)制編碼的二進(jìn)制字符串
  • sodium_bin2hex() - 編碼為十六進(jìn)制
  • sodium_crypto_core_ristretto255_from_hash()


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

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號