WPDev.one
Core Class

ParagonIE_Sodium_Compat

class ParagonIE_Sodium_Compat // Constructor: function Object() { [native code] }

No description available.

Methods 128 methods

Method / Return Description
add()
void

Add two numbers (little-endian unsigned), storing the value in the first

Parameters: $val: mixed, $addv: mixed
base642bin()
string

No description available.

Parameters: $encoded: mixed, $variant: mixed, $ignore: mixed
bin2base64()
string

No description available.

Parameters: $decoded: mixed, $variant: mixed
bin2hex()
string

Cache-timing-safe implementation of bin2hex().

Parameters: $string: mixed
compare()
int

Compare two strings, in constant-time.

Parameters: $left: mixed, $right: mixed
crypto_aead_aegis128l_decrypt()
string

Authenticated Encryption with Associated Data: Decryption

Parameters: $ciphertext: mixed, $assocData: mixed, $nonce: mixed, $key: mixed
crypto_aead_aegis128l_encrypt()
string

Authenticated Encryption with Associated Data: Encryption

Parameters: $plaintext: mixed, $assocData: mixed, $nonce: mixed, $key: mixed
crypto_aead_aegis128l_keygen()
string

Return a secure random key for use with the AEGIS-128L

crypto_aead_aegis256_decrypt()
string

Authenticated Encryption with Associated Data: Decryption

Parameters: $ciphertext: mixed, $assocData: mixed, $nonce: mixed, $key: mixed
crypto_aead_aegis256_encrypt()
string

Authenticated Encryption with Associated Data: Encryption

Parameters: $plaintext: mixed, $assocData: mixed, $nonce: mixed, $key: mixed
crypto_aead_aegis256_keygen()
string

Return a secure random key for use with the AEGIS-256

crypto_aead_aes256gcm_is_available()
bool

Is AES-256-GCM even available to use?

crypto_aead_aes256gcm_decrypt()
(string

Authenticated Encryption with Associated Data: Decryption

Parameters: $ciphertext: mixed, $assocData: mixed, $nonce: mixed, $key: mixed
crypto_aead_aes256gcm_encrypt()
string

Authenticated Encryption with Associated Data: Encryption

Parameters: $plaintext: mixed, $assocData: mixed, $nonce: mixed, $key: mixed
crypto_aead_aes256gcm_keygen()
string

Return a secure random key for use with the AES-256-GCM

crypto_aead_chacha20poly1305_decrypt()
string

Authenticated Encryption with Associated Data: Decryption

Parameters: $ciphertext: mixed, $assocData: mixed, $nonce: mixed, $key: mixed
crypto_aead_chacha20poly1305_encrypt()
string

Authenticated Encryption with Associated Data

Parameters: $plaintext: mixed, $assocData: mixed, $nonce: mixed, $key: mixed
crypto_aead_chacha20poly1305_ietf_decrypt()
string

Authenticated Encryption with Associated Data: Decryption

Parameters: $ciphertext: mixed, $assocData: mixed, $nonce: mixed, $key: mixed
crypto_aead_chacha20poly1305_keygen()
string

Return a secure random key for use with the ChaCha20-Poly1305

crypto_aead_chacha20poly1305_ietf_encrypt()
string

Authenticated Encryption with Associated Data

Parameters: $plaintext: mixed, $assocData: mixed, $nonce: mixed, $key: mixed
crypto_aead_chacha20poly1305_ietf_keygen()
string

Return a secure random key for use with the ChaCha20-Poly1305

crypto_aead_xchacha20poly1305_ietf_decrypt()
(string

Authenticated Encryption with Associated Data: Decryption

Parameters: $ciphertext: mixed, $assocData: mixed, $nonce: mixed, $key: mixed, $dontFallback: mixed
crypto_aead_xchacha20poly1305_ietf_encrypt()
string

Authenticated Encryption with Associated Data

Parameters: $plaintext: mixed, $assocData: mixed, $nonce: mixed, $key: mixed, $dontFallback: mixed
crypto_aead_xchacha20poly1305_ietf_keygen()
string

Return a secure random key for use with the XChaCha20-Poly1305

crypto_auth()
string

Authenticate a message. Uses symmetric-key cryptography.

Parameters: $message: mixed, $key: mixed
crypto_auth_keygen()
string

No description available.

crypto_auth_verify()
bool

Verify the MAC of a message previously authenticated with crypto_auth.

Parameters: $mac: mixed, $message: mixed, $key: mixed
crypto_box()
string

Authenticated asymmetric-key encryption. Both the sender and recipient

Parameters: $plaintext: mixed, $nonce: mixed, $keypair: mixed
crypto_box_seal()
string

Anonymous public-key encryption. Only the recipient may decrypt messages.

Parameters: $plaintext: mixed, $publicKey: mixed
crypto_box_seal_open()
string

Opens a message encrypted with crypto_box_seal(). Requires

Parameters: $ciphertext: mixed, $keypair: mixed
crypto_box_keypair()
string

Generate a new random X25519 keypair.

crypto_box_keypair_from_secretkey_and_publickey()
string

Combine two keys into a keypair for use in library methods that expect

Parameters: $secretKey: mixed, $publicKey: mixed
crypto_box_open()
string

Decrypt a message previously encrypted with crypto_box().

Parameters: $ciphertext: mixed, $nonce: mixed, $keypair: mixed
crypto_box_publickey()
string

Extract the public key from a crypto_box keypair.

Parameters: $keypair: mixed
crypto_box_publickey_from_secretkey()
string

Calculate the X25519 public key from a given X25519 secret key.

Parameters: $secretKey: mixed
crypto_box_secretkey()
string

Extract the secret key from a crypto_box keypair.

Parameters: $keypair: mixed
crypto_box_seed_keypair()
string

Generate an X25519 keypair from a seed.

Parameters: $seed: mixed
crypto_generichash()
string

Calculates a BLAKE2b hash, with an optional key.

Parameters: $message: mixed, $key: mixed, $length: mixed
crypto_generichash_final()
string

Get the final BLAKE2b hash output for a given context.

Parameters: $ctx: mixed, $length: mixed
crypto_generichash_init()
string

Initialize a BLAKE2b hashing context, for use in a streaming interface.

Parameters: $key: mixed, $length: mixed
crypto_generichash_init_salt_personal()
string

Initialize a BLAKE2b hashing context, for use in a streaming interface.

Parameters: $key: mixed, $length: mixed, $salt: mixed, $personal: mixed
crypto_generichash_update()
void

Update a BLAKE2b hashing context with additional data.

Parameters: $ctx: mixed, $message: mixed
crypto_generichash_keygen()
string

No description available.

crypto_kdf_derive_from_key()
string

No description available.

Parameters: $subkey_len: mixed, $subkey_id: mixed, $context: mixed, $key: mixed
crypto_kdf_keygen()
string

No description available.

crypto_kx()
string

Perform a key exchange, between a designated client and a server.

Parameters: $my_secret: mixed, $their_public: mixed, $client_public: mixed, $server_public: mixed, $dontFallback: mixed
crypto_kx_seed_keypair()
string

No description available.

Parameters: $seed: mixed
crypto_kx_keypair()
string

No description available.

crypto_kx_client_session_keys()
array{0:

No description available.

Parameters: $keypair: mixed, $serverPublicKey: mixed
crypto_kx_server_session_keys()
array{0:

No description available.

Parameters: $keypair: mixed, $clientPublicKey: mixed
crypto_kx_secretkey()
string

No description available.

Parameters: $kp: mixed
crypto_kx_publickey()
string

No description available.

Parameters: $kp: mixed
crypto_pwhash()
string

No description available.

Parameters: $outlen: mixed, $passwd: mixed, $salt: mixed, $opslimit: mixed, $memlimit: mixed, $alg: mixed
crypto_pwhash_is_available()
bool

!Exclusive to sodium_compat!

crypto_pwhash_str()
string

No description available.

Parameters: $passwd: mixed, $opslimit: mixed, $memlimit: mixed
crypto_pwhash_str_needs_rehash()
bool

Do we need to rehash this password?

Parameters: $hash: mixed, $opslimit: mixed, $memlimit: mixed
crypto_pwhash_str_verify()
bool

No description available.

Parameters: $passwd: mixed, $hash: mixed
crypto_pwhash_scryptsalsa208sha256()
string

No description available.

Parameters: $outlen: mixed, $passwd: mixed, $salt: mixed, $opslimit: mixed, $memlimit: mixed
crypto_pwhash_scryptsalsa208sha256_is_available()
bool

!Exclusive to sodium_compat!

crypto_pwhash_scryptsalsa208sha256_str()
string

No description available.

Parameters: $passwd: mixed, $opslimit: mixed, $memlimit: mixed
crypto_pwhash_scryptsalsa208sha256_str_verify()
bool

No description available.

Parameters: $passwd: mixed, $hash: mixed
crypto_scalarmult()
string

Calculate the shared secret between your secret key and your

Parameters: $secretKey: mixed, $publicKey: mixed
crypto_scalarmult_base()
string

Calculate an X25519 public key from an X25519 secret key.

Parameters: $secretKey: mixed
crypto_secretbox()
string

Authenticated symmetric-key encryption.

Parameters: $plaintext: mixed, $nonce: mixed, $key: mixed
crypto_secretbox_open()
string

Decrypts a message previously encrypted with crypto_secretbox().

Parameters: $ciphertext: mixed, $nonce: mixed, $key: mixed
crypto_secretbox_keygen()
string

Return a secure random key for use with crypto_secretbox

crypto_secretbox_xchacha20poly1305()
string

Authenticated symmetric-key encryption.

Parameters: $plaintext: mixed, $nonce: mixed, $key: mixed
crypto_secretbox_xchacha20poly1305_open()
string

Decrypts a message previously encrypted with crypto_secretbox_xchacha20poly1305().

Parameters: $ciphertext: mixed, $nonce: mixed, $key: mixed
crypto_secretstream_xchacha20poly1305_init_push()
array<int,

No description available.

Parameters: $key: mixed
crypto_secretstream_xchacha20poly1305_init_pull()
string

No description available.

Parameters: $header: mixed, $key: mixed
crypto_secretstream_xchacha20poly1305_push()
string

No description available.

Parameters: $state: mixed, $msg: mixed, $aad: mixed, $tag: mixed
crypto_secretstream_xchacha20poly1305_pull()
(bool

No description available.

Parameters: $state: mixed, $msg: mixed, $aad: mixed
crypto_secretstream_xchacha20poly1305_keygen()
string

No description available.

crypto_secretstream_xchacha20poly1305_rekey()
void

No description available.

Parameters: $state: mixed
crypto_shorthash()
string

Calculates a SipHash-2-4 hash of a message for a given key.

Parameters: $message: mixed, $key: mixed
crypto_shorthash_keygen()
string

Return a secure random key for use with crypto_shorthash

crypto_sign()
string

Returns a signed message. You probably want crypto_sign_detached()

Parameters: $message: mixed, $secretKey: mixed
crypto_sign_open()
string

Validates a signed message then returns the message.

Parameters: $signedMessage: mixed, $publicKey: mixed
crypto_sign_keypair()
string

Generate a new random Ed25519 keypair.

crypto_sign_keypair_from_secretkey_and_publickey()
string

No description available.

Parameters: $sk: mixed, $pk: mixed
crypto_sign_seed_keypair()
string

Generate an Ed25519 keypair from a seed.

Parameters: $seed: mixed
crypto_sign_publickey()
string

Extract an Ed25519 public key from an Ed25519 keypair.

Parameters: $keypair: mixed
crypto_sign_publickey_from_secretkey()
string

Calculate an Ed25519 public key from an Ed25519 secret key.

Parameters: $secretKey: mixed
crypto_sign_secretkey()
string

Extract an Ed25519 secret key from an Ed25519 keypair.

Parameters: $keypair: mixed
crypto_sign_detached()
string

Calculate the Ed25519 signature of a message and return ONLY the signature.

Parameters: $message: mixed, $secretKey: mixed
crypto_sign_verify_detached()
bool

Verify the Ed25519 signature of a message.

Parameters: $signature: mixed, $message: mixed, $publicKey: mixed
crypto_sign_ed25519_pk_to_curve25519()
string

Convert an Ed25519 public key to a Curve25519 public key

Parameters: $pk: mixed
crypto_sign_ed25519_sk_to_curve25519()
string

Convert an Ed25519 secret key to a Curve25519 secret key

Parameters: $sk: mixed
crypto_stream()
string

Expand a key and nonce into a keystream of pseudorandom bytes.

Parameters: $len: mixed, $nonce: mixed, $key: mixed
crypto_stream_xor()
string

DANGER! UNAUTHENTICATED ENCRYPTION!

Parameters: $message: mixed, $nonce: mixed, $key: mixed
crypto_stream_keygen()
string

Return a secure random key for use with crypto_stream

crypto_stream_xchacha20()
string

Expand a key and nonce into a keystream of pseudorandom bytes.

Parameters: $len: mixed, $nonce: mixed, $key: mixed, $dontFallback: mixed
crypto_stream_xchacha20_xor()
string

DANGER! UNAUTHENTICATED ENCRYPTION!

Parameters: $message: mixed, $nonce: mixed, $key: mixed, $dontFallback: mixed
crypto_stream_xchacha20_xor_ic()
string

DANGER! UNAUTHENTICATED ENCRYPTION!

Parameters: $message: mixed, $nonce: mixed, $counter: mixed, $key: mixed, $dontFallback: mixed
crypto_stream_xchacha20_keygen()
string

Return a secure random key for use with crypto_stream_xchacha20

hex2bin()
string

Cache-timing-safe implementation of hex2bin().

Parameters: $string: mixed, $ignore: mixed
increment()
void

Increase a string (little endian)

Parameters: $var: mixed
is_zero()
bool

No description available.

Parameters: $str: mixed
library_version_major()
int

The equivalent to the libsodium minor version we aim to be compatible

library_version_minor()
int

The equivalent to the libsodium minor version we aim to be compatible

memcmp()
int

Compare two strings.

Parameters: $left: mixed, $right: mixed
memzero()
void

It's actually not possible to zero memory buffers in PHP. You need the

Parameters: $var: mixed
pad()
string

No description available.

Parameters: $unpadded: mixed, $blockSize: mixed, $dontFallback: mixed
unpad()
string

No description available.

Parameters: $padded: mixed, $blockSize: mixed, $dontFallback: mixed
polyfill_is_fast()
bool

Will sodium_compat run fast on the current hardware and PHP configuration?

randombytes_buf()
string

Generate a string of bytes from the kernel's CSPRNG.

Parameters: $numBytes: mixed
randombytes_uniform()
int

Generate an integer between 0 and $range (non-inclusive).

Parameters: $range: mixed
randombytes_random16()
int

Generate a random 16-bit integer.

ristretto255_is_valid_point()
bool

No description available.

Parameters: $p: mixed, $dontFallback: mixed
ristretto255_add()
string

No description available.

Parameters: $p: mixed, $q: mixed, $dontFallback: mixed
ristretto255_sub()
string

No description available.

Parameters: $p: mixed, $q: mixed, $dontFallback: mixed
ristretto255_from_hash()
string

No description available.

Parameters: $r: mixed, $dontFallback: mixed
ristretto255_random()
string

No description available.

Parameters: $dontFallback: mixed
ristretto255_scalar_random()
string

No description available.

Parameters: $dontFallback: mixed
ristretto255_scalar_invert()
string

No description available.

Parameters: $s: mixed, $dontFallback: mixed
ristretto255_scalar_negate()
string

No description available.

Parameters: $s: mixed, $dontFallback: mixed
ristretto255_scalar_complement()
string

No description available.

Parameters: $s: mixed, $dontFallback: mixed
ristretto255_scalar_add()
string

No description available.

Parameters: $x: mixed, $y: mixed, $dontFallback: mixed
ristretto255_scalar_sub()
string

No description available.

Parameters: $x: mixed, $y: mixed, $dontFallback: mixed
ristretto255_scalar_mul()
string

No description available.

Parameters: $x: mixed, $y: mixed, $dontFallback: mixed
scalarmult_ristretto255()
string

No description available.

Parameters: $n: mixed, $p: mixed, $dontFallback: mixed
scalarmult_ristretto255_base()
string

No description available.

Parameters: $n: mixed, $dontFallback: mixed
ristretto255_scalar_reduce()
string

No description available.

Parameters: $s: mixed, $dontFallback: mixed
runtime_speed_test()
bool

Runtime testing method for 32-bit platforms.

Parameters: $iterations: mixed, $maxTimeout: mixed
sub()
void

Add two numbers (little-endian unsigned), storing the value in the first

Parameters: $val: mixed, $addv: mixed
version_string()
string

This emulates libsodium's version_string() function, except ours is

use_fallback()
bool

Should we use the libsodium core function instead?

Parameters: $sodium_func_name: mixed
useNewSodiumAPI()
bool

Libsodium as implemented in PHP 7.2

Properties

Property / Type Description
$disableFallbackForUnitTests
mixed
public
No description available.
$fastMult
mixed
public
No description available.

Class Information

Source File
wp-includes/sodium_compat/src/Compat.php
Advertisement