Ref/sodium-Phpdoc专题
sodium_add
Add large numbers
说明
void <span
class="methodname">sodium_add ( <span
class="type">string &$string1
, <span
class="methodparam">string $string2
)
Warning
本函数还未编写文档,仅有参数列表。
参数
string1
string2
返回值
没有返回值。
sodium_base642bin
Description
说明
string <span
class="methodname">sodium_base642bin ( <span
class="methodparam">string $string
,
int $id
[,
string
$ignore
= "" ] )
Warning
本函数还未编写文档,仅有参数列表。
参数
string
id
ignore
返回值
sodium_bin2base64
Description
说明
string <span
class="methodname">sodium_bin2base64 ( <span
class="methodparam">string $string
,
int $id
)
Warning
本函数还未编写文档,仅有参数列表。
参数
string
id
返回值
sodium_bin2hex
Encode to hexadecimal
说明
string <span
class="methodname">sodium_bin2hex ( <span
class="methodparam">string $string
)
Warning
本函数还未编写文档,仅有参数列表。
参数
string
返回值
sodium_compare
Compare large numbers
说明
int <span
class="methodname">sodium_compare ( <span
class="methodparam">string $string1
,
string
$string2
)
Warning
本函数还未编写文档,仅有参数列表。
参数
string1
string2
返回值
sodium_crypto_aead_aes256gcm_decrypt
Decrypt in combined mode with precalculation
说明
string<span
class="type">false <span
class="methodname">sodium_crypto_aead_aes256gcm_decrypt (
string
$ciphertext
, <span
class="type">string $additional_data
, <span
class="methodparam">string $nonce
,
string $key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
ciphertext
additional_data
nonce
key
返回值
sodium_crypto_aead_aes256gcm_encrypt
Encrypt in combined mode with precalculation
说明
string <span
class="methodname">sodium_crypto_aead_aes256gcm_encrypt (
string
$message
, <span
class="type">string $additional_data
, <span
class="methodparam">string $nonce
,
string $key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
message
additional_data
nonce
key
返回值
sodium_crypto_aead_aes256gcm_is_available
Check if hardware supports AES256-GCM
说明
bool <span class="methodname">sodium_crypto_aead_aes256gcm_is_available ( void )
Warning
本函数还未编写文档,仅有参数列表。
参数
此函数没有参数。
返回值
sodium_crypto_aead_aes256gcm_keygen
Get random bytes for key
说明
string <span class="methodname">sodium_crypto_aead_aes256gcm_keygen ( void )
Warning
本函数还未编写文档,仅有参数列表。
参数
此函数没有参数。
返回值
sodium_crypto_aead_chacha20poly1305_decrypt
Verify that the ciphertext includes a valid tag
说明
string<span
class="type">false <span
class="methodname">sodium_crypto_aead_chacha20poly1305_decrypt
( string
$ciphertext
, <span
class="type">string $additional_data
, <span
class="methodparam">string $nonce
,
string $key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
ciphertext
additional_data
nonce
key
返回值
sodium_crypto_aead_chacha20poly1305_encrypt
Encrypt a message
说明
string <span
class="methodname">sodium_crypto_aead_chacha20poly1305_encrypt
( string
$message
, <span
class="type">string $additional_data
, <span
class="methodparam">string $nonce
,
string $key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
message
additional_data
nonce
key
返回值
sodium_crypto_aead_chacha20poly1305_ietf_decrypt
Verify that the ciphertext includes a valid tag
说明
string<span
class="type">false <span
class="methodname">sodium_crypto_aead_chacha20poly1305_ietf_decrypt
( string
$ciphertext
, <span
class="type">string $additional_data
, <span
class="methodparam">string $nonce
,
string $key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
ciphertext
additional_data
nonce
key
返回值
sodium_crypto_aead_chacha20poly1305_ietf_encrypt
Encrypt a message
说明
string <span
class="methodname">sodium_crypto_aead_chacha20poly1305_ietf_encrypt
( string
$message
, <span
class="type">string $additional_data
, <span
class="methodparam">string $nonce
,
string $key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
message
additional_data
nonce
key
返回值
sodium_crypto_aead_chacha20poly1305_ietf_keygen
Get random bytes for key
说明
string <span class="methodname">sodium_crypto_aead_chacha20poly1305_ietf_keygen ( void )
Warning
本函数还未编写文档,仅有参数列表。
参数
此函数没有参数。
返回值
sodium_crypto_aead_chacha20poly1305_keygen
Get random bytes for key
说明
string <span class="methodname">sodium_crypto_aead_chacha20poly1305_keygen ( void )
Warning
本函数还未编写文档,仅有参数列表。
参数
此函数没有参数。
返回值
sodium_crypto_aead_xchacha20poly1305_ietf_decrypt
Description
说明
string<span
class="type">false <span
class="methodname">sodium_crypto_aead_xchacha20poly1305_ietf_decrypt
( string
$ciphertext
, <span
class="type">string $additional_data
, <span
class="methodparam">string $nonce
,
string $key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
ciphertext
additional_data
nonce
key
返回值
sodium_crypto_aead_xchacha20poly1305_ietf_encrypt
Description
说明
string <span
class="methodname">sodium_crypto_aead_xchacha20poly1305_ietf_encrypt
( string
$message
, <span
class="type">string $additional_data
, <span
class="methodparam">string $nonce
,
string $key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
message
additional_data
nonce
key
返回值
sodium_crypto_aead_xchacha20poly1305_ietf_keygen
Description
说明
string <span class="methodname">sodium_crypto_aead_xchacha20poly1305_ietf_keygen ( void )
Warning
本函数还未编写文档,仅有参数列表。
参数
此函数没有参数。
返回值
sodium_crypto_auth_keygen
Get random bytes for key
说明
string <span class="methodname">sodium_crypto_auth_keygen ( <span class="methodparam">void )
Warning
本函数还未编写文档,仅有参数列表。
参数
此函数没有参数。
返回值
sodium_crypto_auth_verify
Verifies that the tag is valid for the message
说明
bool <span
class="methodname">sodium_crypto_auth_verify ( <span
class="methodparam">string $mac
,
string
$message
, <span
class="type">string $key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
mac
message
key
返回值
sodium_crypto_auth
Compute a tag for the message
说明
string <span
class="methodname">sodium_crypto_auth ( <span
class="methodparam">string $message
,
string $key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
message
key
返回值
sodium_crypto_box_keypair_from_secretkey_and_publickey
Description
说明
string <span
class="methodname">sodium_crypto_box_keypair_from_secretkey_and_publickey
( string
$secret_key
, <span
class="type">string $public_key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
secret_key
public_key
返回值
sodium_crypto_box_keypair
Randomly generate a secret key and a corresponding public key
说明
string <span class="methodname">sodium_crypto_box_keypair ( <span class="methodparam">void )
Warning
本函数还未编写文档,仅有参数列表。
参数
此函数没有参数。
返回值
sodium_crypto_box_open
Verify and decrypt a ciphertext
说明
string<span
class="type">false <span
class="methodname">sodium_crypto_box_open ( <span
class="methodparam">string
$ciphertext
, <span
class="type">string $nonce
, <span
class="methodparam">string $key_pair
)
Warning
本函数还未编写文档,仅有参数列表。
参数
ciphertext
nonce
key_pair
返回值
sodium_crypto_box_publickey_from_secretkey
Description
说明
string <span
class="methodname">sodium_crypto_box_publickey_from_secretkey
( string
$secret_key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
secret_key
返回值
sodium_crypto_box_publickey
Description
说明
string <span
class="methodname">sodium_crypto_box_publickey ( <span
class="methodparam">string $key_pair
)
Warning
本函数还未编写文档,仅有参数列表。
参数
key_pair
返回值
sodium_crypto_box_seal_open
Decrypt the ciphertext
说明
string<span
class="type">false <span
class="methodname">sodium_crypto_box_seal_open ( <span
class="methodparam">string
$ciphertext
, <span
class="type">string $key_pair
)
Warning
本函数还未编写文档,仅有参数列表。
参数
ciphertext
key_pair
返回值
sodium_crypto_box_seal
Encrypt a message
说明
string <span
class="methodname">sodium_crypto_box_seal ( <span
class="methodparam">string $message
,
string
$key_pair
)
Warning
本函数还未编写文档,仅有参数列表。
参数
message
key_pair
返回值
sodium_crypto_box_secretkey
Description
说明
string <span
class="methodname">sodium_crypto_box_secretkey ( <span
class="methodparam">string $key_pair
)
Warning
本函数还未编写文档,仅有参数列表。
参数
key_pair
返回值
sodium_crypto_box_seed_keypair
Deterministically derive the key pair from a single key
说明
string <span
class="methodname">sodium_crypto_box_seed_keypair ( <span
class="methodparam">string $seed
)
Warning
本函数还未编写文档,仅有参数列表。
参数
seed
返回值
sodium_crypto_box
Encrypt a message
说明
string <span
class="methodname">sodium_crypto_box ( <span
class="methodparam">string $message
,
string
$nonce
, <span
class="type">string $key_pair
)
Warning
本函数还未编写文档,仅有参数列表。
参数
message
nonce
key_pair
返回值
sodium_crypto_generichash_final
Complete the hash
说明
string <span
class="methodname">sodium_crypto_generichash_final ( <span
class="methodparam">string &$state
[, int
$length
=
SODIUM_CRYPTO_GENERICHASH_BYTES
] )
Warning
本函数还未编写文档,仅有参数列表。
参数
state
length
返回值
sodium_crypto_generichash_init
Initialize a hash
说明
string <span
class="methodname">sodium_crypto_generichash_init ([ <span
class="methodparam">string $key
<span
class="initializer"> = "" [, <span
class="methodparam">int $length
<span
class="initializer"> =
SODIUM_CRYPTO_GENERICHASH_BYTES
]] )
Warning
本函数还未编写文档,仅有参数列表。
参数
key
length
返回值
sodium_crypto_generichash_keygen
Get random bytes for key
说明
string <span class="methodname">sodium_crypto_generichash_keygen ( <span class="methodparam">void )
Warning
本函数还未编写文档,仅有参数列表。
参数
此函数没有参数。
返回值
sodium_crypto_generichash_update
Add message to a hash
说明
bool <span
class="methodname">sodium_crypto_generichash_update ( <span
class="methodparam">string &$state
,
string
$message
)
Warning
本函数还未编写文档,仅有参数列表。
参数
state
message
返回值
sodium_crypto_generichash
Get a hash of the message
说明
string <span
class="methodname">sodium_crypto_generichash ( <span
class="methodparam">string $message
[, string
$key
= "" [, <span
class="methodparam">int $length
<span
class="initializer"> =
SODIUM_CRYPTO_GENERICHASH_BYTES
]] )
Warning
本函数还未编写文档,仅有参数列表。
参数
message
key
length
返回值
sodium_crypto_kdf_derive_from_key
Derive a subkey
说明
string <span
class="methodname">sodium_crypto_kdf_derive_from_key ( <span
class="methodparam">int
$subkey_length
, <span
class="type">int $subkey_id
, <span
class="methodparam">string $context
,
string $key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
subkey_length
subkey_id
context
key
返回值
sodium_crypto_kdf_keygen
Get random bytes for key
说明
string <span class="methodname">sodium_crypto_kdf_keygen ( <span class="methodparam">void )
Warning
本函数还未编写文档,仅有参数列表。
参数
此函数没有参数。
返回值
sodium_crypto_kx_client_session_keys
Description
说明
array <span
class="methodname">sodium_crypto_kx_client_session_keys (
string
$client_key_pair
, <span
class="type">string $server_key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
client_key_pair
server_key
返回值
sodium_crypto_kx_keypair
Creates a new sodium keypair
说明
string <span class="methodname">sodium_crypto_kx_keypair ( <span class="methodparam">void )
Create a new sodium keypair consisting of the secret key (32 bytes) followed by the public key (32 bytes). The keys can be retrieved by calling sodium_crypto_kx_secretkey and sodium_crypto_kx_publickey, respectively.
参数
此函数没有参数。
返回值
Returns the new keypair on success; throws an exception otherwise.
范例
示例 #1 sodium_crypto_kx_keypair usage
Create a new keypair and retrieve the secret and the public key from it.
<?php
$keypair = sodium_crypto_kx_keypair();
$secret = sodium_crypto_kx_secretkey($keypair);
$public = sodium_crypto_kx_publickey($keypair);
printf("secret: %s\npublic: %s", bin2hex($secret), bin2hex($public));
?>
以上例程的输出类似于:
secret: e7c5c918fdc40762e6000542c0118f4368ce8fd242b0e48c1e17202797a25daf
public: d1f59fda8652caf40ed1a01d2b6f3802b60846986372cd8fa337b7c12c428b18
sodium_crypto_kx_publickey
Description
说明
string <span
class="methodname">sodium_crypto_kx_publickey ( <span
class="methodparam">string $key_pair
)
Warning
本函数还未编写文档,仅有参数列表。
参数
key_pair
返回值
sodium_crypto_kx_secretkey
Description
说明
string <span
class="methodname">sodium_crypto_kx_secretkey ( <span
class="methodparam">string $key_pair
)
Warning
本函数还未编写文档,仅有参数列表。
参数
key_pair
返回值
sodium_crypto_kx_seed_keypair
Description
说明
string <span
class="methodname">sodium_crypto_kx_seed_keypair ( <span
class="methodparam">string $seed
)
Warning
本函数还未编写文档,仅有参数列表。
参数
seed
返回值
sodium_crypto_kx_server_session_keys
Description
说明
array <span
class="methodname">sodium_crypto_kx_server_session_keys (
string
$server_key_pair
, <span
class="type">string $client_key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
server_key_pair
client_key
返回值
sodium_crypto_pwhash_scryptsalsa208sha256_str_verify
Verify that the password is a valid password verification string
说明
bool <span
class="methodname">sodium_crypto_pwhash_scryptsalsa208sha256_str_verify
( string
$hash
, <span
class="type">string $password
)
Warning
本函数还未编写文档,仅有参数列表。
参数
hash
password
返回值
sodium_crypto_pwhash_scryptsalsa208sha256_str
Get an ASCII encoded hash
说明
string <span
class="methodname">sodium_crypto_pwhash_scryptsalsa208sha256_str
( string
$password
, <span
class="type">int $opslimit
, <span
class="methodparam">int $memlimit
)
Warning
本函数还未编写文档,仅有参数列表。
参数
password
opslimit
memlimit
返回值
sodium_crypto_pwhash_scryptsalsa208sha256
Derives a key from a password
说明
string <span
class="methodname">sodium_crypto_pwhash_scryptsalsa208sha256 (
int $length
, string
$password
, <span
class="type">string $salt
, <span
class="methodparam">int $opslimit
,
int
$memlimit
)
Warning
本函数还未编写文档,仅有参数列表。
参数
length
password
salt
opslimit
memlimit
返回值
sodium_crypto_pwhash_str_needs_rehash
Description
说明
bool <span
class="methodname">sodium_crypto_pwhash_str_needs_rehash (
string
$password
, <span
class="type">int $opslimit
, <span
class="methodparam">int $memlimit
)
Warning
本函数还未编写文档,仅有参数列表。
参数
password
opslimit
memlimit
返回值
sodium_crypto_pwhash_str_verify
Verifies that a password matches a hash
说明
bool <span
class="methodname">sodium_crypto_pwhash_str_verify ( <span
class="methodparam">string $hash
,
string
$password
)
Checks that a password hash created using <span class="function">sodium_crypto_pwhash_str matches a given plain-text password. Note that the parameters are in the opposite order to the same parameters in the similar <span class="function">password_hash function.
参数
hash
一个由 password_hash 创建的散列值。
password
用户的密码。
返回值
Returns true
if the password and hash match, or false
otherwise.
注释
Note:
Hashes are calculated using the Argon2ID algorithm, providing resistance to both GPU and side-channel attacks.
参见
- sodium_crypto_pwhash_str
- password_hash
- password_verify
sodium_crypto_pwhash_str
Get an ASCII-encoded hash
说明
string <span
class="methodname">sodium_crypto_pwhash_str ( <span
class="methodparam">string $password
, int
$opslimit
, <span
class="type">int $memlimit
)
Uses a CPU- and memory-hard hash algorithm along with a randomly-generated salt, and memory and CPU limits to generate an ASCII-encoded hash suitable for password storage.
参数
password
string; The password to generate a hash for.
opslimit
Represents a maximum amount of computations to perform. Raising this
number will make the function require more CPU cycles to compute a key.
There are constants available to set the operations limit to appropriate
values depending on intended use, in order of strength:
SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE
,
SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE
and
SODIUM_CRYPTO_PWHASH_OPSLIMIT_SENSITIVE
.
memlimit
The maximum amount of RAM that the function will use, in bytes. There
are constants to help you choose an appropriate value, in order of size:
SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE
,
SODIUM_CRYPTO_PWHASH_MEMLIMIT_MODERATE
, and
SODIUM_CRYPTO_PWHASH_MEMLIMIT_SENSITIVE
. Typically these should be
paired with the matching opslimit values.
返回值
Returns the hashed password.
In order to produce the same password hash from the same password, the
same values for opslimit
and memlimit
must be used. These are
embedded within the generated hash, so everything that's needed to
verify the hash is included. This allows the <span
class="function">sodium_crypto_pwhash_str_verify function to
verify the hash without needing separate storage for the other
parameters.
注释
Note:
Hashes are calculated using the Argon2ID algorithm, providing resistance to both GPU and side-channel attacks. In contrast to the password_hash function, there is no salt parameter (a salt is generated automatically), and the
opslimit
andmemlimit
parameters are not optional.
范例
示例 #1 password_hash example
<?php
$password = 'password';
echo sodium_crypto_pwhash_str(
$password,
SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE,
SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE
);
以上例程的输出类似于:
$argon2id$v=19$m=65536,t=2,p=1$oWIfdaXwWwhVmovOBc2NAQ$EbsZ+JnZyyavkafS0hoc4HdaOB0ILWZESAZ7kVGa+Iw
参见
- sodium_crypto_pwhash_str_verify
- sodium_crypto_pwhash
- password_hash
- password_verify
- » Libsodium Argon2 docs
sodium_crypto_pwhash
Derive a key from a password
说明
string <span
class="methodname">sodium_crypto_pwhash ( <span
class="methodparam">int $length
,
string
$password
, <span
class="type">string $salt
, <span
class="methodparam">int $opslimit
,
int
$memlimit
[, <span
class="type">int $algo
=
SODIUM_CRYPTO_PWHASH_ALG_DEFAULT
] )
This function provides low-level access to libsodium's crypto_pwhash key derivation function. Unless you have specific reason to use this function, you should use <span class="function">sodium_crypto_pwhash_str or <span class="function">password_hash functions instead.
参数
length
int; The length of the password hash to
generate, in bytes.
password
string; The password to generate a hash for.
salt
string A salt to add to the password before
hashing. The salt should be unpredictable, ideally generated from a good
random mumber source such as <span
class="function">random_bytes, and have a length of at least
SODIUM_CRYPTO_PWHASH_SALTBYTES
bytes.
opslimit
Represents a maximum amount of computations to perform. Raising this
number will make the function require more CPU cycles to compute a key.
There are some constants available to set the operations limit to
appropriate values depending on intended use, in order of strength:
SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE
,
SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE
and
SODIUM_CRYPTO_PWHASH_OPSLIMIT_SENSITIVE
.
memlimit
The maximum amount of RAM that the function will use, in bytes. There
are constants to help you choose an appropriate value, in order of size:
SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE
,
SODIUM_CRYPTO_PWHASH_MEMLIMIT_MODERATE
, and
SODIUM_CRYPTO_PWHASH_MEMLIMIT_SENSITIVE
. Typically these should be
paired with the matching opslimit
values.
algo
int A number indicating the hash algorithm to
use. By default SODIUM_CRYPTO_PWHASH_ALG_DEFAULT
(the currently
recommended algorithm, which can change from one version of libsodium to
another), or explicitly using SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13
,
representing the Argon2id algorithm version 1.3.
返回值
Returns the derived key. The return value is a binary string of the hash, not an ASCII-encoded representation, and does not contain additional information about the parameters used to create the hash, so you will need to keep that information if you are ever going to verify the password in future. Use <span class="function">sodium_crypto_pwhash_str to avoid needing to do all that.
范例
示例 #1 password_hash example
<?php
//Need to keep the salt if we're ever going to be able to check this password
$salt = random_bytes(SODIUM_CRYPTO_PWHASH_SALTBYTES);
//Using bin2hex to keep output readable
echo bin2hex(
sodium_crypto_pwhash(
16, // == 128 bits
'password',
$salt,
SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE,
SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE,
SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13
)
);
?>
以上例程的输出类似于:
a18f346ba57992eb7e4ae6abf3fd30ee
sodium_crypto_scalarmult_base
别名 <span class="function">sodium_crypto_box_publickey_from_secretkey
说明
此函数是该函数的别名: <span class="function">sodium_crypto_box_publickey_from_secretkey.
sodium_crypto_scalarmult
Compute a shared secret given a user's secret key and another user's public key
说明
string <span
class="methodname">sodium_crypto_scalarmult ( <span
class="methodparam">string $n
, <span
class="methodparam">string $p
)
Warning
本函数还未编写文档,仅有参数列表。
参数
n
p
返回值
sodium_crypto_secretbox_keygen
Get random bytes for key
说明
string <span class="methodname">sodium_crypto_secretbox_keygen ( <span class="methodparam">void )
Warning
本函数还未编写文档,仅有参数列表。
参数
此函数没有参数。
返回值
sodium_crypto_secretbox_open
Verify and decrypt a ciphertext
说明
string<span
class="type">false <span
class="methodname">sodium_crypto_secretbox_open ( <span
class="methodparam">string
$ciphertext
, <span
class="type">string $nonce
, <span
class="methodparam">string $key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
ciphertext
nonce
key
返回值
sodium_crypto_secretbox
Encrypt a message
说明
string <span
class="methodname">sodium_crypto_secretbox ( <span
class="methodparam">string $message
,
string
$nonce
, <span
class="type">string $key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
message
nonce
key
返回值
sodium_crypto_secretstream_xchacha20poly1305_init_pull
Description
说明
string <span
class="methodname">sodium_crypto_secretstream_xchacha20poly1305_init_pull
( string
$header
, <span
class="type">string $key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
header
key
返回值
sodium_crypto_secretstream_xchacha20poly1305_init_push
Description
说明
array <span
class="methodname">sodium_crypto_secretstream_xchacha20poly1305_init_push
( string
$key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
key
返回值
sodium_crypto_secretstream_xchacha20poly1305_keygen
Description
说明
string <span class="methodname">sodium_crypto_secretstream_xchacha20poly1305_keygen ( void )
Warning
本函数还未编写文档,仅有参数列表。
参数
此函数没有参数。
返回值
sodium_crypto_secretstream_xchacha20poly1305_pull
Description
说明
array<span
class="type">false <span
class="methodname">sodium_crypto_secretstream_xchacha20poly1305_pull
( string
&$state
, <span
class="type">string $ciphertext
[, <span
class="methodparam">string
$additional_data
= "" ] )
Warning
本函数还未编写文档,仅有参数列表。
参数
state
ciphertext
additional_data
返回值
sodium_crypto_secretstream_xchacha20poly1305_push
Description
说明
string <span
class="methodname">sodium_crypto_secretstream_xchacha20poly1305_push
( string
&$state
, <span
class="type">string $message
[, <span
class="methodparam">string
$additional_data
= "" [,
int $tag
<span
class="initializer"> =
SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE
]] )
Warning
本函数还未编写文档,仅有参数列表。
参数
state
message
additional_data
tag
返回值
sodium_crypto_secretstream_xchacha20poly1305_rekey
Description
说明
void <span
class="methodname">sodium_crypto_secretstream_xchacha20poly1305_rekey
( string
&$state
)
Warning
本函数还未编写文档,仅有参数列表。
参数
state
返回值
sodium_crypto_shorthash_keygen
Get random bytes for key
说明
string <span class="methodname">sodium_crypto_shorthash_keygen ( <span class="methodparam">void )
Warning
本函数还未编写文档,仅有参数列表。
参数
此函数没有参数。
返回值
sodium_crypto_shorthash
Compute a fixed-size fingerprint for the message
说明
string <span
class="methodname">sodium_crypto_shorthash ( <span
class="methodparam">string $message
,
string $key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
message
key
返回值
sodium_crypto_sign_detached
Sign the message
说明
string <span
class="methodname">sodium_crypto_sign_detached ( <span
class="methodparam">string $message
,
string
$secret_key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
message
secret_key
返回值
sodium_crypto_sign_ed25519_pk_to_curve25519
Convert an Ed25519 public key to a Curve25519 public key
说明
string <span
class="methodname">sodium_crypto_sign_ed25519_pk_to_curve25519
( string
$public_key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
public_key
返回值
sodium_crypto_sign_ed25519_sk_to_curve25519
Convert an Ed25519 secret key to a Curve25519 secret key
说明
string <span
class="methodname">sodium_crypto_sign_ed25519_sk_to_curve25519
( string
$secret_key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
secret_key
返回值
sodium_crypto_sign_keypair_from_secretkey_and_publickey
Description
说明
string <span
class="methodname">sodium_crypto_sign_keypair_from_secretkey_and_publickey
( string
$secret_key
, <span
class="type">string $public_key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
secret_key
public_key
返回值
sodium_crypto_sign_keypair
Randomly generate a secret key and a corresponding public key
说明
string <span class="methodname">sodium_crypto_sign_keypair ( <span class="methodparam">void )
Warning
本函数还未编写文档,仅有参数列表。
参数
此函数没有参数。
返回值
sodium_crypto_sign_open
Check that the signed message has a valid signature
说明
string<span
class="type">false <span
class="methodname">sodium_crypto_sign_open ( <span
class="methodparam">string
$ciphertext
, <span
class="type">string $public_key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
ciphertext
public_key
返回值
sodium_crypto_sign_publickey_from_secretkey
Extract the public key from the secret key
说明
string <span
class="methodname">sodium_crypto_sign_publickey_from_secretkey
( string
$secret_key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
secret_key
返回值
sodium_crypto_sign_publickey
Description
说明
string <span
class="methodname">sodium_crypto_sign_publickey ( <span
class="methodparam">string $key_pair
)
Warning
本函数还未编写文档,仅有参数列表。
参数
key_pair
返回值
sodium_crypto_sign_secretkey
Description
说明
string <span
class="methodname">sodium_crypto_sign_secretkey ( <span
class="methodparam">string $key_pair
)
Warning
本函数还未编写文档,仅有参数列表。
参数
key_pair
返回值
sodium_crypto_sign_seed_keypair
Deterministically derive the key pair from a single key
说明
string <span
class="methodname">sodium_crypto_sign_seed_keypair ( <span
class="methodparam">string $seed
)
Warning
本函数还未编写文档,仅有参数列表。
参数
seed
返回值
sodium_crypto_sign_verify_detached
Verify signature for the message
说明
bool <span
class="methodname">sodium_crypto_sign_verify_detached ( <span
class="methodparam">string $signature
, string
$message
, <span
class="type">string $public_key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
signature
message
public_key
返回值
sodium_crypto_sign
Sign a message
说明
string <span
class="methodname">sodium_crypto_sign ( <span
class="methodparam">string $message
,
string
$secret_key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
message
secret_key
返回值
sodium_crypto_stream_keygen
Get random bytes for key
说明
string <span class="methodname">sodium_crypto_stream_keygen ( <span class="methodparam">void )
Warning
本函数还未编写文档,仅有参数列表。
参数
此函数没有参数。
返回值
sodium_crypto_stream_xor
Encrypt a message
说明
string <span
class="methodname">sodium_crypto_stream_xor ( <span
class="methodparam">string $message
,
string
$nonce
, <span
class="type">string $key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
message
nonce
key
返回值
sodium_crypto_stream
Generate a deterministic sequence of bytes from a seed
说明
string <span
class="methodname">sodium_crypto_stream ( <span
class="methodparam">int $length
,
string
$nonce
, <span
class="type">string $key
)
Warning
本函数还未编写文档,仅有参数列表。
参数
length
nonce
key
返回值
sodium_hex2bin
Decodes a hexadecimally encoded binary string
说明
string <span
class="methodname">sodium_hex2bin ( <span
class="methodparam">string $string
[, string
$ignore
= "" ] )
Decodes a hexadecimally encoded binary string.
Like sodium_bin2hex, <span class="function">sodium_hex2bin is resistant to side-channel attacks while hex2bin is not.
参数
string
Hexadecimal representation of data.
ignore
Optional string argument for characters to ignore.
返回值
Returns the binary representation of the given string
data.
sodium_increment
Increment large number
说明
void <span
class="methodname">sodium_increment ( <span
class="methodparam">string &$string
)
Warning
本函数还未编写文档,仅有参数列表。
参数
string
返回值
sodium_memcmp
Test for equality in constant-time
说明
int <span
class="methodname">sodium_memcmp ( <span
class="methodparam">string $string1
,
string
$string2
)
Warning
本函数还未编写文档,仅有参数列表。
参数
string1
string2
返回值
sodium_memzero
Overwrite buf with zeros
说明
void <span
class="methodname">sodium_memzero ( <span
class="methodparam">string &$string
)
Warning
本函数还未编写文档,仅有参数列表。
参数
string
返回值
sodium_pad
Add padding data
说明
string <span
class="methodname">sodium_pad ( <span
class="type">string $string
, <span
class="methodparam">int $length
)
Warning
本函数还未编写文档,仅有参数列表。
参数
string
length
返回值
sodium_unpad
Remove padding data
说明
string <span
class="methodname">sodium_unpad ( <span
class="methodparam">string $string
,
int
$block_size
)
Warning
本函数还未编写文档,仅有参数列表。
参数
string
block_size
返回值
目录
- sodium_add — Add large numbers
- sodium_base642bin — Description
- sodium_bin2base64 — Description
- sodium_bin2hex — Encode to hexadecimal
- sodium_compare — Compare large numbers
- sodium_crypto_aead_aes256gcm_decrypt — Decrypt in combined mode with precalculation
- sodium_crypto_aead_aes256gcm_encrypt — Encrypt in combined mode with precalculation
- sodium_crypto_aead_aes256gcm_is_available — Check if hardware supports AES256-GCM
- sodium_crypto_aead_aes256gcm_keygen — Get random bytes for key
- sodium_crypto_aead_chacha20poly1305_decrypt — Verify that the ciphertext includes a valid tag
- sodium_crypto_aead_chacha20poly1305_encrypt — Encrypt a message
- sodium_crypto_aead_chacha20poly1305_ietf_decrypt — Verify that the ciphertext includes a valid tag
- sodium_crypto_aead_chacha20poly1305_ietf_encrypt — Encrypt a message
- sodium_crypto_aead_chacha20poly1305_ietf_keygen — Get random bytes for key
- sodium_crypto_aead_chacha20poly1305_keygen — Get random bytes for key
- sodium_crypto_aead_xchacha20poly1305_ietf_decrypt — Description
- sodium_crypto_aead_xchacha20poly1305_ietf_encrypt — Description
- sodium_crypto_aead_xchacha20poly1305_ietf_keygen — Description
- sodium_crypto_auth_keygen — Get random bytes for key
- sodium_crypto_auth_verify — Verifies that the tag is valid for the message
- sodium_crypto_auth — Compute a tag for the message
- sodium_crypto_box_keypair_from_secretkey_and_publickey — Description
- sodium_crypto_box_keypair — Randomly generate a secret key and a corresponding public key
- sodium_crypto_box_open — Verify and decrypt a ciphertext
- sodium_crypto_box_publickey_from_secretkey — Description
- sodium_crypto_box_publickey — Description
- sodium_crypto_box_seal_open — Decrypt the ciphertext
- sodium_crypto_box_seal — Encrypt a message
- sodium_crypto_box_secretkey — Description
- sodium_crypto_box_seed_keypair — Deterministically derive the key pair from a single key
- sodium_crypto_box — Encrypt a message
- sodium_crypto_generichash_final — Complete the hash
- sodium_crypto_generichash_init — Initialize a hash
- sodium_crypto_generichash_keygen — Get random bytes for key
- sodium_crypto_generichash_update — Add message to a hash
- sodium_crypto_generichash — Get a hash of the message
- sodium_crypto_kdf_derive_from_key — Derive a subkey
- sodium_crypto_kdf_keygen — Get random bytes for key
- sodium_crypto_kx_client_session_keys — Description
- sodium_crypto_kx_keypair — Creates a new sodium keypair
- sodium_crypto_kx_publickey — Description
- sodium_crypto_kx_secretkey — Description
- sodium_crypto_kx_seed_keypair — Description
- sodium_crypto_kx_server_session_keys — Description
- sodium_crypto_pwhash_scryptsalsa208sha256_str_verify — Verify that the password is a valid password verification string
- sodium_crypto_pwhash_scryptsalsa208sha256_str — Get an ASCII encoded hash
- sodium_crypto_pwhash_scryptsalsa208sha256 — Derives a key from a password
- sodium_crypto_pwhash_str_needs_rehash — Description
- sodium_crypto_pwhash_str_verify — Verifies that a password matches a hash
- sodium_crypto_pwhash_str — Get an ASCII-encoded hash
- sodium_crypto_pwhash — Derive a key from a password
- sodium_crypto_scalarmult_base — 别名 sodium_crypto_box_publickey_from_secretkey
- sodium_crypto_scalarmult — Compute a shared secret given a user's secret key and another user's public key
- sodium_crypto_secretbox_keygen — Get random bytes for key
- sodium_crypto_secretbox_open — Verify and decrypt a ciphertext
- sodium_crypto_secretbox — Encrypt a message
- sodium_crypto_secretstream_xchacha20poly1305_init_pull — Description
- sodium_crypto_secretstream_xchacha20poly1305_init_push — Description
- sodium_crypto_secretstream_xchacha20poly1305_keygen — Description
- sodium_crypto_secretstream_xchacha20poly1305_pull — Description
- sodium_crypto_secretstream_xchacha20poly1305_push — Description
- sodium_crypto_secretstream_xchacha20poly1305_rekey — Description
- sodium_crypto_shorthash_keygen — Get random bytes for key
- sodium_crypto_shorthash — Compute a fixed-size fingerprint for the message
- sodium_crypto_sign_detached — Sign the message
- sodium_crypto_sign_ed25519_pk_to_curve25519 — Convert an Ed25519 public key to a Curve25519 public key
- sodium_crypto_sign_ed25519_sk_to_curve25519 — Convert an Ed25519 secret key to a Curve25519 secret key
- sodium_crypto_sign_keypair_from_secretkey_and_publickey — Description
- sodium_crypto_sign_keypair — Randomly generate a secret key and a corresponding public key
- sodium_crypto_sign_open — Check that the signed message has a valid signature
- sodium_crypto_sign_publickey_from_secretkey — Extract the public key from the secret key
- sodium_crypto_sign_publickey — Description
- sodium_crypto_sign_secretkey — Description
- sodium_crypto_sign_seed_keypair — Deterministically derive the key pair from a single key
- sodium_crypto_sign_verify_detached — Verify signature for the message
- sodium_crypto_sign — Sign a message
- sodium_crypto_stream_keygen — Get random bytes for key
- sodium_crypto_stream_xor — Encrypt a message
- sodium_crypto_stream — Generate a deterministic sequence of bytes from a seed
- sodium_hex2bin — Decodes a hexadecimally encoded binary string
- sodium_increment — Increment large number
- sodium_memcmp — Test for equality in constant-time
- sodium_memzero — Overwrite buf with zeros
- sodium_pad — Add padding data
- sodium_unpad — Remove padding data