Joomla CMS  3.10.11 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.10.11 et du framework Joomla Platform intégré
Référence de la classe ParagonIE_Sodium_Compat
+ Graphe d'héritage de ParagonIE_Sodium_Compat:

Fonctions membres publiques statiques

static add (&$val, $addv)
 
static bin2hex ($string)
 
static compare ($left, $right)
 
static crypto_aead_aes256gcm_is_available ()
 
static crypto_aead_aes256gcm_encrypt ( $plaintext='', $assocData='', $nonce='', $key='')
 
static crypto_aead_aes256gcm_keygen ()
 
static crypto_aead_chacha20poly1305_decrypt ( $ciphertext='', $assocData='', $nonce='', $key='')
 
static crypto_aead_chacha20poly1305_encrypt ( $plaintext='', $assocData='', $nonce='', $key='')
 
static crypto_aead_chacha20poly1305_ietf_decrypt ( $ciphertext='', $assocData='', $nonce='', $key='')
 
static crypto_aead_chacha20poly1305_keygen ()
 
static crypto_aead_chacha20poly1305_ietf_encrypt ( $plaintext='', $assocData='', $nonce='', $key='')
 
static crypto_aead_chacha20poly1305_ietf_keygen ()
 
static crypto_aead_xchacha20poly1305_ietf_decrypt ( $ciphertext='', $assocData='', $nonce='', $key='', $dontFallback=false)
 
static crypto_aead_xchacha20poly1305_ietf_encrypt ( $plaintext='', $assocData='', $nonce='', $key='', $dontFallback=false)
 
static crypto_aead_xchacha20poly1305_ietf_keygen ()
 
static crypto_auth ($message, $key)
 
static crypto_auth_keygen ()
 
static crypto_auth_verify ($mac, $message, $key)
 
static crypto_box ($plaintext, $nonce, $keypair)
 
static crypto_box_seal ($plaintext, $publicKey)
 
static crypto_box_seal_open ($ciphertext, $keypair)
 
static crypto_box_keypair ()
 
static crypto_box_keypair_from_secretkey_and_publickey ($secretKey, $publicKey)
 
static crypto_box_open ($ciphertext, $nonce, $keypair)
 
static crypto_box_publickey ($keypair)
 
static crypto_box_publickey_from_secretkey ($secretKey)
 
static crypto_box_secretkey ($keypair)
 
static crypto_box_seed_keypair ($seed)
 
static crypto_generichash ($message, $key='', $length=self::CRYPTO_GENERICHASH_BYTES)
 
static crypto_generichash_final (&$ctx, $length=self::CRYPTO_GENERICHASH_BYTES)
 
static crypto_generichash_init ($key='', $length=self::CRYPTO_GENERICHASH_BYTES)
 
static crypto_generichash_init_salt_personal ( $key='', $length=self::CRYPTO_GENERICHASH_BYTES, $salt='', $personal='')
 
static crypto_generichash_update (&$ctx, $message)
 
static crypto_generichash_keygen ()
 
static crypto_kdf_derive_from_key ( $subkey_len, $subkey_id, $context, $key)
 
static crypto_kdf_keygen ()
 
static crypto_kx ($my_secret, $their_public, $client_public, $server_public, $dontFallback=false)
 
static crypto_kx_seed_keypair ($seed)
 
static crypto_kx_keypair ()
 
static crypto_kx_client_session_keys ($keypair, $serverPublicKey)
 
static crypto_kx_server_session_keys ($keypair, $clientPublicKey)
 
static crypto_kx_secretkey ($kp)
 
static crypto_kx_publickey ($kp)
 
static crypto_pwhash ($outlen, $passwd, $salt, $opslimit, $memlimit, $alg=null)
 
static crypto_pwhash_is_available ()
 
static crypto_pwhash_str ($passwd, $opslimit, $memlimit)
 
static crypto_pwhash_str_verify ($passwd, $hash)
 
static crypto_pwhash_scryptsalsa208sha256 ($outlen, $passwd, $salt, $opslimit, $memlimit)
 
static crypto_pwhash_scryptsalsa208sha256_is_available ()
 
static crypto_pwhash_scryptsalsa208sha256_str ($passwd, $opslimit, $memlimit)
 
static crypto_pwhash_scryptsalsa208sha256_str_verify ($passwd, $hash)
 
static crypto_scalarmult ($secretKey, $publicKey)
 
static crypto_scalarmult_base ($secretKey)
 
static crypto_secretbox ($plaintext, $nonce, $key)
 
static crypto_secretbox_open ($ciphertext, $nonce, $key)
 
static crypto_secretbox_keygen ()
 
static crypto_secretbox_xchacha20poly1305 ($plaintext, $nonce, $key)
 
static crypto_secretbox_xchacha20poly1305_open ($ciphertext, $nonce, $key)
 
static crypto_secretstream_xchacha20poly1305_init_push ($key)
 
static crypto_secretstream_xchacha20poly1305_init_pull ($header, $key)
 
static crypto_secretstream_xchacha20poly1305_push (&$state, $msg, $aad='', $tag=0)
 
static crypto_secretstream_xchacha20poly1305_pull (&$state, $msg, $aad='')
 
static crypto_secretstream_xchacha20poly1305_keygen ()
 
static crypto_secretstream_xchacha20poly1305_rekey (&$state)
 
static crypto_shorthash ($message, $key)
 
static crypto_shorthash_keygen ()
 
static crypto_sign ($message, $secretKey)
 
static crypto_sign_open ($signedMessage, $publicKey)
 
static crypto_sign_keypair ()
 
static crypto_sign_keypair_from_secretkey_and_publickey ($sk, $pk)
 
static crypto_sign_seed_keypair ($seed)
 
static crypto_sign_publickey ($keypair)
 
static crypto_sign_publickey_from_secretkey ($secretKey)
 
static crypto_sign_secretkey ($keypair)
 
static crypto_sign_detached ($message, $secretKey)
 
static crypto_sign_verify_detached ($signature, $message, $publicKey)
 
static crypto_sign_ed25519_pk_to_curve25519 ($pk)
 
static crypto_sign_ed25519_sk_to_curve25519 ($sk)
 
static crypto_stream ($len, $nonce, $key)
 
static crypto_stream_xor ($message, $nonce, $key)
 
static crypto_stream_keygen ()
 
static crypto_stream_xchacha20 ($len, $nonce, $key, $dontFallback=false)
 
static crypto_stream_xchacha20_xor ($message, $nonce, $key, $dontFallback=false)
 
static crypto_stream_xchacha20_keygen ()
 
static hex2bin ($string)
 
static increment (&$var)
 
static is_zero ($str)
 
static library_version_major ()
 
static library_version_minor ()
 
static memzero (&$var)
 
static unpad ($padded, $blockSize, $dontFallback=false)
 
static polyfill_is_fast ()
 
static randombytes_uniform ($range)
 
static randombytes_random16 ()
 
static ristretto255_is_valid_point ($p, $dontFallback=false)
 
static ristretto255_add ($p, $q, $dontFallback=false)
 
static ristretto255_sub ($p, $q, $dontFallback=false)
 
static ristretto255_from_hash ($r, $dontFallback=false)
 
static ristretto255_random ($dontFallback=false)
 
static ristretto255_scalar_random ($dontFallback=false)
 
static ristretto255_scalar_invert ($s, $dontFallback=false)
 
static ristretto255_scalar_negate ($s, $dontFallback=false)
 
static ristretto255_scalar_complement ($s, $dontFallback=false)
 
static ristretto255_scalar_add ($x, $y, $dontFallback=false)
 
static ristretto255_scalar_sub ($x, $y, $dontFallback=false)
 
static ristretto255_scalar_mul ($x, $y, $dontFallback=false)
 
static scalarmult_ristretto255 ($n, $p, $dontFallback=false)
 
static scalarmult_ristretto255_base ($n, $dontFallback=false)
 
static ristretto255_scalar_reduce ($s, $dontFallback=false)
 
static sub (&$val, $addv)
 
static version_string ()
 

Champs de données

const LIBRARY_MAJOR_VERSION = 9
 
const LIBRARY_MINOR_VERSION = 1
 
const LIBRARY_VERSION_MAJOR = 9
 
const LIBRARY_VERSION_MINOR = 1
 
const VERSION_STRING = 'polyfill-1.0.8'
 
const BASE64_VARIANT_ORIGINAL = 1
 
const BASE64_VARIANT_ORIGINAL_NO_PADDING = 3
 
const BASE64_VARIANT_URLSAFE = 5
 
const BASE64_VARIANT_URLSAFE_NO_PADDING = 7
 
const CRYPTO_AEAD_AES256GCM_KEYBYTES = 32
 
const CRYPTO_AEAD_AES256GCM_NSECBYTES = 0
 
const CRYPTO_AEAD_AES256GCM_NPUBBYTES = 12
 
const CRYPTO_AEAD_AES256GCM_ABYTES = 16
 
const CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES = 32
 
const CRYPTO_AEAD_CHACHA20POLY1305_NSECBYTES = 0
 
const CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES = 8
 
const CRYPTO_AEAD_CHACHA20POLY1305_ABYTES = 16
 
const CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES = 32
 
const CRYPTO_AEAD_CHACHA20POLY1305_IETF_NSECBYTES = 0
 
const CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES = 12
 
const CRYPTO_AEAD_CHACHA20POLY1305_IETF_ABYTES = 16
 
const CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES = 32
 
const CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NSECBYTES = 0
 
const CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES = 24
 
const CRYPTO_AEAD_XCHACHA20POLY1305_IETF_ABYTES = 16
 
const CRYPTO_AUTH_BYTES = 32
 
const CRYPTO_AUTH_KEYBYTES = 32
 
const CRYPTO_BOX_SEALBYTES = 16
 
const CRYPTO_BOX_SECRETKEYBYTES = 32
 
const CRYPTO_BOX_PUBLICKEYBYTES = 32
 
const CRYPTO_BOX_KEYPAIRBYTES = 64
 
const CRYPTO_BOX_MACBYTES = 16
 
const CRYPTO_BOX_NONCEBYTES = 24
 
const CRYPTO_BOX_SEEDBYTES = 32
 
const CRYPTO_CORE_RISTRETTO255_BYTES = 32
 
const CRYPTO_CORE_RISTRETTO255_SCALARBYTES = 32
 
const CRYPTO_CORE_RISTRETTO255_HASHBYTES = 64
 
const CRYPTO_CORE_RISTRETTO255_NONREDUCEDSCALARBYTES = 64
 
const CRYPTO_KDF_BYTES_MIN = 16
 
const CRYPTO_KDF_BYTES_MAX = 64
 
const CRYPTO_KDF_CONTEXTBYTES = 8
 
const CRYPTO_KDF_KEYBYTES = 32
 
const CRYPTO_KX_BYTES = 32
 
const CRYPTO_KX_PRIMITIVE = 'x25519blake2b'
 
const CRYPTO_KX_SEEDBYTES = 32
 
const CRYPTO_KX_KEYPAIRBYTES = 64
 
const CRYPTO_KX_PUBLICKEYBYTES = 32
 
const CRYPTO_KX_SECRETKEYBYTES = 32
 
const CRYPTO_KX_SESSIONKEYBYTES = 32
 
const CRYPTO_GENERICHASH_BYTES = 32
 
const CRYPTO_GENERICHASH_BYTES_MIN = 16
 
const CRYPTO_GENERICHASH_BYTES_MAX = 64
 
const CRYPTO_GENERICHASH_KEYBYTES = 32
 
const CRYPTO_GENERICHASH_KEYBYTES_MIN = 16
 
const CRYPTO_GENERICHASH_KEYBYTES_MAX = 64
 
const CRYPTO_PWHASH_SALTBYTES = 16
 
const CRYPTO_PWHASH_STRPREFIX = '$argon2id$'
 
const CRYPTO_PWHASH_ALG_ARGON2I13 = 1
 
const CRYPTO_PWHASH_ALG_ARGON2ID13 = 2
 
const CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE = 33554432
 
const CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE = 4
 
const CRYPTO_PWHASH_MEMLIMIT_MODERATE = 134217728
 
const CRYPTO_PWHASH_OPSLIMIT_MODERATE = 6
 
const CRYPTO_PWHASH_MEMLIMIT_SENSITIVE = 536870912
 
const CRYPTO_PWHASH_OPSLIMIT_SENSITIVE = 8
 
const CRYPTO_PWHASH_SCRYPTSALSA208SHA256_SALTBYTES = 32
 
const CRYPTO_PWHASH_SCRYPTSALSA208SHA256_STRPREFIX = '$7$'
 
const CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_INTERACTIVE = 534288
 
const CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE = 16777216
 
const CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_SENSITIVE = 33554432
 
const CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_SENSITIVE = 1073741824
 
const CRYPTO_SCALARMULT_BYTES = 32
 
const CRYPTO_SCALARMULT_SCALARBYTES = 32
 
const CRYPTO_SCALARMULT_RISTRETTO255_BYTES = 32
 
const CRYPTO_SCALARMULT_RISTRETTO255_SCALARBYTES = 32
 
const CRYPTO_SHORTHASH_BYTES = 8
 
const CRYPTO_SHORTHASH_KEYBYTES = 16
 
const CRYPTO_SECRETBOX_KEYBYTES = 32
 
const CRYPTO_SECRETBOX_MACBYTES = 16
 
const CRYPTO_SECRETBOX_NONCEBYTES = 24
 
const CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_ABYTES = 17
 
const CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES = 24
 
const CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES = 32
 
const CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PUSH = 0
 
const CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PULL = 1
 
const CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_REKEY = 2
 
const CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_FINAL = 3
 
const CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_MESSAGEBYTES_MAX = 0x3fffffff80
 
const CRYPTO_SIGN_BYTES = 64
 
const CRYPTO_SIGN_SEEDBYTES = 32
 
const CRYPTO_SIGN_PUBLICKEYBYTES = 32
 
const CRYPTO_SIGN_SECRETKEYBYTES = 64
 
const CRYPTO_SIGN_KEYPAIRBYTES = 96
 
const CRYPTO_STREAM_KEYBYTES = 32
 
const CRYPTO_STREAM_NONCEBYTES = 24
 
const CRYPTO_STREAM_XCHACHA20_KEYBYTES = 32
 
const CRYPTO_STREAM_XCHACHA20_NONCEBYTES = 24
 

Attributs publics statiques

static $disableFallbackForUnitTests = false
 
static $fastMult = false
 

Fonctions membres protégées statiques

static use_fallback ($sodium_func_name='')
 
static useNewSodiumAPI ()
 

Description détaillée

Libsodium compatibility layer

This is the only class you should be interfacing with, as a user of sodium_compat.

If the PHP extension for libsodium is installed, it will always use that instead of our implementations. You get better performance and stronger guarantees against side-channels that way.

However, if your users don't have the PHP extension installed, we offer a compatible interface here. It will give you the correct results as if the PHP extension was installed. It won't be as fast, of course.

CAUTION * CAUTION * CAUTION * CAUTION * CAUTION * CAUTION * CAUTION * CAUTION *

  • Until audited, this is probably not safe to use! DANGER WILL ROBINSON *
  • CAUTION * CAUTION * CAUTION * CAUTION * CAUTION * CAUTION * CAUTION * CAUTION *

Documentation des fonctions membres

◆ add()

static add ( $val,
  $addv 
)
static

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

This mutates $val.

Paramètres
string$val
string$addv
Renvoie
void
Exceptions
SodiumException

Références $i, et ParagonIE_Sodium_Core_Util\strlen().

Référencé par ParagonIE_Sodium_Core_Ed25519\scalar_add().

◆ bin2hex()

static bin2hex (   $string)
static

Cache-timing-safe implementation of bin2hex().

Paramètres
string$stringA string (probably raw binary)
Renvoie
string A hexadecimal-encoded string
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références ParagonIE_Sodium_Core_Util\declareScalarType().

◆ compare()

static compare (   $left,
  $right 
)
static

Compare two strings, in constant-time. Compared to memcmp(), compare() is more useful for sorting.

Paramètres
string$leftThe left operand; must be a string
string$rightThe right operand; must be a string
Renvoie
int If < 0 if the left operand is less than the right If = 0 if both strings are equal If > 0 if the right operand is less than the left
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références ParagonIE_Sodium_Core_Util\compare(), et ParagonIE_Sodium_Core_Util\declareScalarType().

◆ crypto_aead_aes256gcm_encrypt()

static crypto_aead_aes256gcm_encrypt (   $plaintext = '',
  $assocData = '',
  $nonce = '',
  $key = '' 
)
static

Authenticated Encryption with Associated Data: Encryption

Algorithm: AES-256-GCM

Paramètres
string$plaintextMessage to be encrypted
string$assocDataAuthenticated Associated Data (unencrypted)
string$nonceNumber to be used only Once; must be 8 bytes
string$keyEncryption key
Renvoie
string Ciphertext with a 16-byte GCM message authentication code appended
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $key, Sodium\CRYPTO_AEAD_AES256GCM_KEYBYTES, Sodium\CRYPTO_AEAD_AES256GCM_NPUBBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_aead_aes256gcm_is_available()

static crypto_aead_aes256gcm_is_available ( )
static

Is AES-256-GCM even available to use?

Renvoie
bool -suppress UndefinedFunction -suppress MixedInferredReturnType -suppress MixedReturnStatement

◆ crypto_aead_aes256gcm_keygen()

static crypto_aead_aes256gcm_keygen ( )
static

Return a secure random key for use with the AES-256-GCM symmetric AEAD interface.

Renvoie
string
Exceptions
Exception
Error

Références Sodium\CRYPTO_AEAD_AES256GCM_KEYBYTES.

◆ crypto_aead_chacha20poly1305_decrypt()

static crypto_aead_chacha20poly1305_decrypt (   $ciphertext = '',
  $assocData = '',
  $nonce = '',
  $key = '' 
)
static

Authenticated Encryption with Associated Data: Decryption

Algorithm: ChaCha20-Poly1305

This mode uses a 64-bit random nonce with a 64-bit counter. IETF mode uses a 96-bit random nonce with a 32-bit counter.

Paramètres
string$ciphertextEncrypted message (with Poly1305 MAC appended)
string$assocDataAuthenticated Associated Data (unencrypted)
string$nonceNumber to be used only Once; must be 8 bytes
string$keyEncryption key
Renvoie
string The original plaintext message
Exceptions
SodiumException
TypeError-suppress MixedArgument -suppress MixedInferredReturnType -suppress MixedReturnStatement

-suppress InvalidReturnStatement -suppress FalsableReturnStatement

Références $key, Sodium\CRYPTO_AEAD_CHACHA20POLY1305_ABYTES, Sodium\CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES, Sodium\CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_aead_chacha20poly1305_encrypt()

static crypto_aead_chacha20poly1305_encrypt (   $plaintext = '',
  $assocData = '',
  $nonce = '',
  $key = '' 
)
static

Authenticated Encryption with Associated Data

Algorithm: ChaCha20-Poly1305

This mode uses a 64-bit random nonce with a 64-bit counter. IETF mode uses a 96-bit random nonce with a 32-bit counter.

Paramètres
string$plaintextMessage to be encrypted
string$assocDataAuthenticated Associated Data (unencrypted)
string$nonceNumber to be used only Once; must be 8 bytes
string$keyEncryption key
Renvoie
string Ciphertext with a 16-byte Poly1305 message authentication code appended
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $key, Sodium\CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES, Sodium\CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_aead_chacha20poly1305_ietf_decrypt()

static crypto_aead_chacha20poly1305_ietf_decrypt (   $ciphertext = '',
  $assocData = '',
  $nonce = '',
  $key = '' 
)
static

Authenticated Encryption with Associated Data: Decryption

Algorithm: ChaCha20-Poly1305

IETF mode uses a 96-bit random nonce with a 32-bit counter. Regular mode uses a 64-bit random nonce with a 64-bit counter.

Paramètres
string$ciphertextEncrypted message (with Poly1305 MAC appended)
string$assocDataAuthenticated Associated Data (unencrypted)
string$nonceNumber to be used only Once; must be 12 bytes
string$keyEncryption key
Renvoie
string The original plaintext message
Exceptions
SodiumException
TypeError-suppress MixedArgument -suppress MixedInferredReturnType -suppress MixedReturnStatement

-suppress InvalidReturnStatement -suppress FalsableReturnStatement

Références $key, Sodium\CRYPTO_AEAD_CHACHA20POLY1305_ABYTES, Sodium\CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES, Sodium\CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_aead_chacha20poly1305_ietf_encrypt()

static crypto_aead_chacha20poly1305_ietf_encrypt (   $plaintext = '',
  $assocData = '',
  $nonce = '',
  $key = '' 
)
static

Authenticated Encryption with Associated Data

Algorithm: ChaCha20-Poly1305

IETF mode uses a 96-bit random nonce with a 32-bit counter. Regular mode uses a 64-bit random nonce with a 64-bit counter.

Paramètres
string$plaintextMessage to be encrypted
string$assocDataAuthenticated Associated Data (unencrypted)
string$nonceNumber to be used only Once; must be 8 bytes
string$keyEncryption key
Renvoie
string Ciphertext with a 16-byte Poly1305 message authentication code appended
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $key, Sodium\CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES, Sodium\CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_aead_chacha20poly1305_ietf_keygen()

static crypto_aead_chacha20poly1305_ietf_keygen ( )
static

Return a secure random key for use with the ChaCha20-Poly1305 symmetric AEAD interface. (IETF version)

Renvoie
string
Exceptions
Exception
Error

Références Sodium\CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES.

◆ crypto_aead_chacha20poly1305_keygen()

static crypto_aead_chacha20poly1305_keygen ( )
static

Return a secure random key for use with the ChaCha20-Poly1305 symmetric AEAD interface.

Renvoie
string
Exceptions
Exception
Error

Références Sodium\CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES.

◆ crypto_aead_xchacha20poly1305_ietf_decrypt()

static crypto_aead_xchacha20poly1305_ietf_decrypt (   $ciphertext = '',
  $assocData = '',
  $nonce = '',
  $key = '',
  $dontFallback = false 
)
static

Authenticated Encryption with Associated Data: Decryption

Algorithm: XChaCha20-Poly1305

This mode uses a 64-bit random nonce with a 64-bit counter. IETF mode uses a 96-bit random nonce with a 32-bit counter.

Paramètres
string$ciphertextEncrypted message (with Poly1305 MAC appended)
string$assocDataAuthenticated Associated Data (unencrypted)
string$nonceNumber to be used only Once; must be 8 bytes
string$keyEncryption key
bool$dontFallbackDon't fallback to ext/sodium
Renvoie
string|bool The original plaintext message
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $key, ParagonIE_Sodium_Crypto\aead_xchacha20poly1305_ietf_decrypt(), ParagonIE_Sodium_Crypto32\aead_xchacha20poly1305_ietf_decrypt(), ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_aead_xchacha20poly1305_ietf_encrypt()

static crypto_aead_xchacha20poly1305_ietf_encrypt (   $plaintext = '',
  $assocData = '',
  $nonce = '',
  $key = '',
  $dontFallback = false 
)
static

Authenticated Encryption with Associated Data

Algorithm: XChaCha20-Poly1305

This mode uses a 64-bit random nonce with a 64-bit counter. IETF mode uses a 96-bit random nonce with a 32-bit counter.

Paramètres
string$plaintextMessage to be encrypted
string$assocDataAuthenticated Associated Data (unencrypted)
string$nonceNumber to be used only Once; must be 8 bytes
string$keyEncryption key
bool$dontFallbackDon't fallback to ext/sodium
Renvoie
string Ciphertext with a 16-byte Poly1305 message authentication code appended
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $key, ParagonIE_Sodium_Crypto\aead_xchacha20poly1305_ietf_encrypt(), ParagonIE_Sodium_Crypto32\aead_xchacha20poly1305_ietf_encrypt(), ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_aead_xchacha20poly1305_ietf_keygen()

static crypto_aead_xchacha20poly1305_ietf_keygen ( )
static

Return a secure random key for use with the XChaCha20-Poly1305 symmetric AEAD interface.

Renvoie
string
Exceptions
Exception
Error

◆ crypto_auth()

static crypto_auth (   $message,
  $key 
)
static

Authenticate a message. Uses symmetric-key cryptography.

Algorithm: HMAC-SHA512-256. Which is HMAC-SHA-512 truncated to 256 bits. Not to be confused with HMAC-SHA-512/256 which would use the SHA-512/256 hash function (uses different initial parameters but still truncates to 256 bits to sidestep length-extension attacks).

Paramètres
string$messageMessage to be authenticated
string$keySymmetric authentication key
Renvoie
string Message authentication code
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $key, $message, ParagonIE_Sodium_Crypto32\auth(), ParagonIE_Sodium_Crypto\auth(), Sodium\CRYPTO_AUTH_KEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_auth_keygen()

static crypto_auth_keygen ( )
static
Renvoie
string
Exceptions
Exception
Error

Références Sodium\CRYPTO_AUTH_KEYBYTES.

◆ crypto_auth_verify()

static crypto_auth_verify (   $mac,
  $message,
  $key 
)
static

Verify the MAC of a message previously authenticated with crypto_auth.

Paramètres
string$macMessage authentication code
string$messageMessage whose authenticity you are attempting to verify (with a given MAC and key)
string$keySymmetric authentication key
Renvoie
bool TRUE if authenticated, FALSE otherwise
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $key, $message, ParagonIE_Sodium_Crypto\auth_verify(), ParagonIE_Sodium_Crypto32\auth_verify(), Sodium\CRYPTO_AUTH_BYTES, Sodium\CRYPTO_AUTH_KEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_box()

static crypto_box (   $plaintext,
  $nonce,
  $keypair 
)
static

Authenticated asymmetric-key encryption. Both the sender and recipient may decrypt messages.

Algorithm: X25519-XSalsa20-Poly1305. X25519: Elliptic-Curve Diffie Hellman over Curve25519. XSalsa20: Extended-nonce variant of salsa20. Poyl1305: Polynomial MAC for one-time message authentication.

Paramètres
string$plaintextThe message to be encrypted
string$nonceA Number to only be used Once; must be 24 bytes
string$keypairYour secret key and your recipient's public key
Renvoie
string Ciphertext with 16-byte Poly1305 MAC
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références ParagonIE_Sodium_Crypto32\box(), ParagonIE_Sodium_Crypto\box(), Sodium\CRYPTO_BOX_KEYPAIRBYTES, Sodium\CRYPTO_BOX_NONCEBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

Référencé par SodiumCipher\encrypt().

◆ crypto_box_keypair()

static crypto_box_keypair ( )
static

Generate a new random X25519 keypair.

Renvoie
string A 64-byte string; the first 32 are your secret key, while the last 32 are your public key. crypto_box_secretkey() and crypto_box_publickey() exist to separate them so you don't accidentally get them mixed up!
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références ParagonIE_Sodium_Crypto32\box_keypair(), et ParagonIE_Sodium_Crypto\box_keypair().

Référencé par SodiumCipher\generateKey().

◆ crypto_box_keypair_from_secretkey_and_publickey()

static crypto_box_keypair_from_secretkey_and_publickey (   $secretKey,
  $publicKey 
)
static

Combine two keys into a keypair for use in library methods that expect a keypair. This doesn't necessarily have to be the same person's keys.

Paramètres
string$secretKeySecret key
string$publicKeyPublic key
Renvoie
string Keypair
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références ParagonIE_Sodium_Crypto32\box_keypair_from_secretkey_and_publickey(), ParagonIE_Sodium_Crypto\box_keypair_from_secretkey_and_publickey(), Sodium\CRYPTO_BOX_PUBLICKEYBYTES, Sodium\CRYPTO_BOX_SECRETKEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

Référencé par SodiumCipher\decrypt(), et SodiumCipher\encrypt().

◆ crypto_box_open()

static crypto_box_open (   $ciphertext,
  $nonce,
  $keypair 
)
static

Decrypt a message previously encrypted with crypto_box().

Paramètres
string$ciphertextEncrypted message
string$nonceNumber to only be used Once; must be 24 bytes
string$keypairYour secret key and the sender's public key
Renvoie
string The original plaintext message
Exceptions
SodiumException
TypeError-suppress MixedArgument -suppress MixedInferredReturnType -suppress MixedReturnStatement

-suppress InvalidReturnStatement -suppress FalsableReturnStatement

Références ParagonIE_Sodium_Crypto32\box_open(), ParagonIE_Sodium_Crypto\box_open(), Sodium\CRYPTO_BOX_KEYPAIRBYTES, Sodium\CRYPTO_BOX_MACBYTES, Sodium\CRYPTO_BOX_NONCEBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

Référencé par SodiumCipher\decrypt().

◆ crypto_box_publickey()

static crypto_box_publickey (   $keypair)
static

Extract the public key from a crypto_box keypair.

Paramètres
string$keypairKeypair containing secret and public key
Renvoie
string Your crypto_box public key
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références ParagonIE_Sodium_Crypto32\box_publickey(), ParagonIE_Sodium_Crypto\box_publickey(), Sodium\CRYPTO_BOX_KEYPAIRBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

Référencé par SodiumCipher\generateKey().

◆ crypto_box_publickey_from_secretkey()

static crypto_box_publickey_from_secretkey (   $secretKey)
static

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

Paramètres
string$secretKeyAny X25519 secret key
Renvoie
string The corresponding X25519 public key
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références ParagonIE_Sodium_Crypto32\box_publickey_from_secretkey(), ParagonIE_Sodium_Crypto\box_publickey_from_secretkey(), Sodium\CRYPTO_BOX_SECRETKEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_box_seal()

static crypto_box_seal (   $plaintext,
  $publicKey 
)
static

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

Algorithm: X25519-XSalsa20-Poly1305, as with crypto_box. The sender's X25519 keypair is ephemeral. Nonce is generated from the BLAKE2b hash of both public keys.

This provides ciphertext integrity.

Paramètres
string$plaintextMessage to be sealed
string$publicKeyYour recipient's public key
Renvoie
string Sealed message that only your recipient can decrypt
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références Sodium\CRYPTO_BOX_PUBLICKEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_box_seal_open()

static crypto_box_seal_open (   $ciphertext,
  $keypair 
)
static

Opens a message encrypted with crypto_box_seal(). Requires the recipient's keypair (sk || pk) to decrypt successfully.

This validates ciphertext integrity.

Paramètres
string$ciphertextSealed message to be opened
string$keypairYour crypto_box keypair
Renvoie
string The original plaintext message
Exceptions
SodiumException
TypeError-suppress MixedArgument -suppress MixedInferredReturnType -suppress MixedReturnStatement

-suppress InvalidReturnStatement -suppress FalsableReturnStatement

Références Sodium\CRYPTO_BOX_KEYPAIRBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_box_secretkey()

static crypto_box_secretkey (   $keypair)
static

Extract the secret key from a crypto_box keypair.

Paramètres
string$keypair
Renvoie
string Your crypto_box secret key
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références ParagonIE_Sodium_Crypto32\box_secretkey(), ParagonIE_Sodium_Crypto\box_secretkey(), Sodium\CRYPTO_BOX_KEYPAIRBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

Référencé par SodiumCipher\generateKey().

◆ crypto_box_seed_keypair()

static crypto_box_seed_keypair (   $seed)
static

Generate an X25519 keypair from a seed.

Paramètres
string$seed
Renvoie
string
Exceptions
SodiumException
TypeError-suppress MixedArgument -suppress UndefinedFunction

Références ParagonIE_Sodium_Crypto32\box_seed_keypair(), ParagonIE_Sodium_Crypto\box_seed_keypair(), et ParagonIE_Sodium_Core_Util\declareScalarType().

◆ crypto_generichash()

static crypto_generichash (   $message,
  $key = '',
  $length = self::CRYPTO_GENERICHASH_BYTES 
)
static

Calculates a BLAKE2b hash, with an optional key.

Paramètres
string$messageThe message to be hashed
string | null$keyIf specified, must be a string between 16 and 64 bytes long
int$lengthOutput length in bytes; must be between 16 and 64 (default = 32)
Renvoie
string Raw binary
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $key, $message, Sodium\CRYPTO_GENERICHASH_KEYBYTES_MAX, Sodium\CRYPTO_GENERICHASH_KEYBYTES_MIN, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

Référencé par ParagonIE_Sodium_Crypto\keyExchange().

◆ crypto_generichash_final()

static crypto_generichash_final ( $ctx,
  $length = self::CRYPTO_GENERICHASH_BYTES 
)
static

Get the final BLAKE2b hash output for a given context.

Paramètres
string$ctxBLAKE2 hashing context. Generated by crypto_generichash_init().
int$lengthHash output size.
Renvoie
string Final BLAKE2b hash.
Exceptions
SodiumException
TypeError-suppress MixedArgument -suppress ReferenceConstraintViolation -suppress ConflictingReferenceConstraint

Références ParagonIE_Sodium_Core_Util\declareScalarType().

◆ crypto_generichash_init()

static crypto_generichash_init (   $key = '',
  $length = self::CRYPTO_GENERICHASH_BYTES 
)
static

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

Paramètres
string | null$keyIf specified must be a string between 16 and 64 bytes
int$lengthThe size of the desired hash output
Renvoie
string A BLAKE2 hashing context, encoded as a string (To be 100% compatible with ext/libsodium)
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $key, Sodium\CRYPTO_GENERICHASH_KEYBYTES_MAX, Sodium\CRYPTO_GENERICHASH_KEYBYTES_MIN, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_generichash_init_salt_personal()

static crypto_generichash_init_salt_personal (   $key = '',
  $length = self::CRYPTO_GENERICHASH_BYTES,
  $salt = '',
  $personal = '' 
)
static

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

Paramètres
string | null$keyIf specified must be a string between 16 and 64 bytes
int$lengthThe size of the desired hash output
string$saltSalt (up to 16 bytes)
string$personalPersonalization string (up to 16 bytes)
Renvoie
string A BLAKE2 hashing context, encoded as a string (To be 100% compatible with ext/libsodium)
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $key, Sodium\CRYPTO_GENERICHASH_KEYBYTES_MAX, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_generichash_keygen()

static crypto_generichash_keygen ( )
static
Renvoie
string
Exceptions
Exception
Error

Références Sodium\CRYPTO_GENERICHASH_KEYBYTES.

◆ crypto_generichash_update()

static crypto_generichash_update ( $ctx,
  $message 
)
static

Update a BLAKE2b hashing context with additional data.

Paramètres
string$ctxBLAKE2 hashing context. Generated by crypto_generichash_init(). $ctx is passed by reference and gets updated in-place.
-outstring $ctx
string$messageThe message to append to the existing hash state.
Renvoie
void
Exceptions
SodiumException
TypeError-suppress MixedArgument -suppress ReferenceConstraintViolation

Références $message, et ParagonIE_Sodium_Core_Util\declareScalarType().

◆ crypto_kdf_derive_from_key()

static crypto_kdf_derive_from_key (   $subkey_len,
  $subkey_id,
  $context,
  $key 
)
static
Paramètres
int$subkey_len
int$subkey_id
string$context
string$key
Renvoie
string
Exceptions
SodiumException

Références $context, $key, $state, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_kdf_keygen()

static crypto_kdf_keygen ( )
static
Renvoie
string
Exceptions
Exception
Error

◆ crypto_kx()

static crypto_kx (   $my_secret,
  $their_public,
  $client_public,
  $server_public,
  $dontFallback = false 
)
static

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

Typically, you would designate one machine to be the client and the other to be the server. The first two keys are what you'd expect for scalarmult() below, but the latter two public keys don't swap places.

| ALICE | BOB |

Client Server
shared = crypto_kx( shared = crypto_kx(

| alice_sk, | bob_sk, | <- contextual | bob_pk, | alice_pk, | <- contextual | alice_pk, | alice_pk, | <--— static | bob_pk | bob_pk | <--— static | ) | ) |

They are used along with the scalarmult product to generate a 256-bit BLAKE2b hash unique to the client and server keys.

Paramètres
string$my_secret
string$their_public
string$client_public
string$server_public
bool$dontFallback
Renvoie
string
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références Sodium\CRYPTO_BOX_PUBLICKEYBYTES, Sodium\CRYPTO_BOX_SECRETKEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), ParagonIE_Sodium_Crypto32\keyExchange(), ParagonIE_Sodium_Crypto\keyExchange(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_kx_client_session_keys()

static crypto_kx_client_session_keys (   $keypair,
  $serverPublicKey 
)
static
Paramètres
string$keypair
string$serverPublicKey
Renvoie
array{0: string, 1: string}
Exceptions
SodiumException

Références Sodium\CRYPTO_KX_PUBLICKEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), null, ParagonIE_Sodium_Core_Util\strlen(), et ParagonIE_Sodium_Core_Util\substr().

◆ crypto_kx_keypair()

static crypto_kx_keypair ( )
static
Renvoie
string
Exceptions
Exception

Références Sodium\CRYPTO_KX_SECRETKEYBYTES.

◆ crypto_kx_publickey()

static crypto_kx_publickey (   $kp)
static
Paramètres
string$kp
Renvoie
string
Exceptions
SodiumException

Références Sodium\CRYPTO_KX_PUBLICKEYBYTES, Sodium\CRYPTO_KX_SECRETKEYBYTES, et ParagonIE_Sodium_Core_Util\substr().

◆ crypto_kx_secretkey()

static crypto_kx_secretkey (   $kp)
static
Paramètres
string$kp
Renvoie
string
Exceptions
SodiumException

Références Sodium\CRYPTO_KX_SECRETKEYBYTES, et ParagonIE_Sodium_Core_Util\substr().

◆ crypto_kx_seed_keypair()

static crypto_kx_seed_keypair (   $seed)
static

◆ crypto_kx_server_session_keys()

static crypto_kx_server_session_keys (   $keypair,
  $clientPublicKey 
)
static
Paramètres
string$keypair
string$clientPublicKey
Renvoie
array{0: string, 1: string}
Exceptions
SodiumException

Références Sodium\CRYPTO_KX_PUBLICKEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), null, ParagonIE_Sodium_Core_Util\strlen(), et ParagonIE_Sodium_Core_Util\substr().

◆ crypto_pwhash()

static crypto_pwhash (   $outlen,
  $passwd,
  $salt,
  $opslimit,
  $memlimit,
  $alg = null 
)
static
Paramètres
int$outlen
string$passwd
string$salt
int$opslimit
int$memlimit
int | null$alg
Renvoie
string
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références ParagonIE_Sodium_Core_Util\declareScalarType().

◆ crypto_pwhash_is_available()

static crypto_pwhash_is_available ( )
static

!Exclusive to sodium_compat!

This returns TRUE if the native crypto_pwhash API is available by libsodium. This returns FALSE if only sodium_compat is available.

Renvoie
bool

◆ crypto_pwhash_scryptsalsa208sha256()

static crypto_pwhash_scryptsalsa208sha256 (   $outlen,
  $passwd,
  $salt,
  $opslimit,
  $memlimit 
)
static
Paramètres
int$outlen
string$passwd
string$salt
int$opslimit
int$memlimit
Renvoie
string
Exceptions
SodiumException
TypeError

Références ParagonIE_Sodium_Core_Util\declareScalarType().

◆ crypto_pwhash_scryptsalsa208sha256_is_available()

static crypto_pwhash_scryptsalsa208sha256_is_available ( )
static

!Exclusive to sodium_compat!

This returns TRUE if the native crypto_pwhash API is available by libsodium. This returns FALSE if only sodium_compat is available.

Renvoie
bool

◆ crypto_pwhash_scryptsalsa208sha256_str()

static crypto_pwhash_scryptsalsa208sha256_str (   $passwd,
  $opslimit,
  $memlimit 
)
static
Paramètres
string$passwd
int$opslimit
int$memlimit
Renvoie
string
Exceptions
SodiumException
TypeError

Références ParagonIE_Sodium_Core_Util\declareScalarType().

◆ crypto_pwhash_scryptsalsa208sha256_str_verify()

static crypto_pwhash_scryptsalsa208sha256_str_verify (   $passwd,
  $hash 
)
static
Paramètres
string$passwd
string$hash
Renvoie
bool
Exceptions
SodiumException
TypeError

Références $hash, et ParagonIE_Sodium_Core_Util\declareScalarType().

◆ crypto_pwhash_str()

static crypto_pwhash_str (   $passwd,
  $opslimit,
  $memlimit 
)
static
Paramètres
string$passwd
int$opslimit
int$memlimit
Renvoie
string
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références ParagonIE_Sodium_Core_Util\declareScalarType().

◆ crypto_pwhash_str_verify()

static crypto_pwhash_str_verify (   $passwd,
  $hash 
)
static
Paramètres
string$passwd
string$hash
Renvoie
bool
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $hash, et ParagonIE_Sodium_Core_Util\declareScalarType().

◆ crypto_scalarmult()

static crypto_scalarmult (   $secretKey,
  $publicKey 
)
static

Calculate the shared secret between your secret key and your recipient's public key.

Algorithm: X25519 (ECDH over Curve25519)

Paramètres
string$secretKey
string$publicKey
Renvoie
string
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références Sodium\CRYPTO_BOX_PUBLICKEYBYTES, Sodium\CRYPTO_BOX_SECRETKEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), ParagonIE_Sodium_Crypto32\scalarmult(), ParagonIE_Sodium_Crypto\scalarmult(), et ParagonIE_Sodium_Core_Util\strlen().

Référencé par ParagonIE_Sodium_Crypto\keyExchange().

◆ crypto_scalarmult_base()

static crypto_scalarmult_base (   $secretKey)
static

Calculate an X25519 public key from an X25519 secret key.

Paramètres
string$secretKey
Renvoie
string
Exceptions
SodiumException
TypeError-suppress TooFewArguments -suppress MixedArgument

Références Sodium\CRYPTO_BOX_SECRETKEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), ParagonIE_Sodium_Crypto32\scalarmult_base(), ParagonIE_Sodium_Crypto\scalarmult_base(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_secretbox()

static crypto_secretbox (   $plaintext,
  $nonce,
  $key 
)
static

Authenticated symmetric-key encryption.

Algorithm: XSalsa20-Poly1305

Paramètres
string$plaintextThe message you're encrypting
string$nonceA Number to be used Once; must be 24 bytes
string$keySymmetric encryption key
Renvoie
string Ciphertext with Poly1305 MAC
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $key, Sodium\CRYPTO_SECRETBOX_KEYBYTES, Sodium\CRYPTO_SECRETBOX_NONCEBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_secretbox_keygen()

static crypto_secretbox_keygen ( )
static

Return a secure random key for use with crypto_secretbox

Renvoie
string
Exceptions
Exception
Error

Références Sodium\CRYPTO_SECRETBOX_KEYBYTES.

◆ crypto_secretbox_open()

static crypto_secretbox_open (   $ciphertext,
  $nonce,
  $key 
)
static

Decrypts a message previously encrypted with crypto_secretbox().

Paramètres
string$ciphertextCiphertext with Poly1305 MAC
string$nonceA Number to be used Once; must be 24 bytes
string$keySymmetric encryption key
Renvoie
string Original plaintext message
Exceptions
SodiumException
TypeError-suppress MixedArgument -suppress MixedInferredReturnType -suppress MixedReturnStatement

-suppress InvalidReturnStatement -suppress FalsableReturnStatement

Références $key, Sodium\CRYPTO_SECRETBOX_KEYBYTES, Sodium\CRYPTO_SECRETBOX_NONCEBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_secretbox_xchacha20poly1305()

static crypto_secretbox_xchacha20poly1305 (   $plaintext,
  $nonce,
  $key 
)
static

Authenticated symmetric-key encryption.

Algorithm: XChaCha20-Poly1305

Paramètres
string$plaintextThe message you're encrypting
string$nonceA Number to be used Once; must be 24 bytes
string$keySymmetric encryption key
Renvoie
string Ciphertext with Poly1305 MAC
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $key, Sodium\CRYPTO_SECRETBOX_KEYBYTES, Sodium\CRYPTO_SECRETBOX_NONCEBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_secretbox_xchacha20poly1305_open()

static crypto_secretbox_xchacha20poly1305_open (   $ciphertext,
  $nonce,
  $key 
)
static

Decrypts a message previously encrypted with crypto_secretbox_xchacha20poly1305().

Paramètres
string$ciphertextCiphertext with Poly1305 MAC
string$nonceA Number to be used Once; must be 24 bytes
string$keySymmetric encryption key
Renvoie
string Original plaintext message
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $key, Sodium\CRYPTO_SECRETBOX_KEYBYTES, Sodium\CRYPTO_SECRETBOX_NONCEBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_secretstream_xchacha20poly1305_init_pull()

static crypto_secretstream_xchacha20poly1305_init_pull (   $header,
  $key 
)
static

◆ crypto_secretstream_xchacha20poly1305_init_push()

static crypto_secretstream_xchacha20poly1305_init_push (   $key)
static
Paramètres
string$key
Renvoie
array<int, string> Returns a state and a header.
Exceptions
Exception
SodiumException

Références $key, ParagonIE_Sodium_Crypto32\secretstream_xchacha20poly1305_init_push(), et ParagonIE_Sodium_Crypto\secretstream_xchacha20poly1305_init_push().

◆ crypto_secretstream_xchacha20poly1305_keygen()

static crypto_secretstream_xchacha20poly1305_keygen ( )
static
Renvoie
string
Exceptions
Exception

◆ crypto_secretstream_xchacha20poly1305_pull()

static crypto_secretstream_xchacha20poly1305_pull ( $state,
  $msg,
  $aad = '' 
)
static
Paramètres
string$state
string$msg
string$aad
Renvoie
bool|array{0: string, 1: int}
Exceptions
SodiumException

Références $state.

◆ crypto_secretstream_xchacha20poly1305_push()

static crypto_secretstream_xchacha20poly1305_push ( $state,
  $msg,
  $aad = '',
  $tag = 0 
)
static
Paramètres
string$state
string$msg
string$aad
int$tag
Renvoie
string
Exceptions
SodiumException

Références $state.

◆ crypto_secretstream_xchacha20poly1305_rekey()

static crypto_secretstream_xchacha20poly1305_rekey ( $state)
static

◆ crypto_shorthash()

static crypto_shorthash (   $message,
  $key 
)
static

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

Paramètres
string$messageInput message
string$keySipHash-2-4 key
Renvoie
string Hash
Exceptions
SodiumException
TypeError-suppress MixedArgument -suppress MixedInferredReturnType -suppress MixedReturnStatement

Références $key, $message, Sodium\CRYPTO_SHORTHASH_KEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), ParagonIE_Sodium_Core32_SipHash\sipHash24(), ParagonIE_Sodium_Core_SipHash\sipHash24(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_shorthash_keygen()

static crypto_shorthash_keygen ( )
static

Return a secure random key for use with crypto_shorthash

Renvoie
string
Exceptions
Exception
Error

Références Sodium\CRYPTO_SHORTHASH_KEYBYTES.

◆ crypto_sign()

static crypto_sign (   $message,
  $secretKey 
)
static

Returns a signed message. You probably want crypto_sign_detached() instead, which only returns the signature.

Algorithm: Ed25519 (EdDSA over Curve25519)

Paramètres
string$messageMessage to be signed.
string$secretKeySecret signing key.
Renvoie
string Signed message (signature is prefixed).
Exceptions
SodiumException
TypeError-suppress MixedArgument -suppress MixedInferredReturnType -suppress MixedReturnStatement

Références $message, Sodium\CRYPTO_SIGN_SECRETKEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), ParagonIE_Sodium_Crypto32\sign(), ParagonIE_Sodium_Crypto\sign(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_sign_detached()

static crypto_sign_detached (   $message,
  $secretKey 
)
static

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

Algorithm: Ed25519 (EdDSA over Curve25519)

Paramètres
string$messageMessage to be signed
string$secretKeySecret signing key
Renvoie
string Digital signature
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $message, Sodium\CRYPTO_SIGN_SECRETKEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), ParagonIE_Sodium_Crypto32\sign_detached(), ParagonIE_Sodium_Crypto\sign_detached(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_sign_ed25519_pk_to_curve25519()

static crypto_sign_ed25519_pk_to_curve25519 (   $pk)
static

Convert an Ed25519 public key to a Curve25519 public key

Paramètres
string$pk
Renvoie
string
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références Sodium\CRYPTO_SIGN_PUBLICKEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), ParagonIE_Sodium_Core32_Ed25519\pk_to_curve25519(), ParagonIE_Sodium_Core_Ed25519\pk_to_curve25519(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_sign_ed25519_sk_to_curve25519()

static crypto_sign_ed25519_sk_to_curve25519 (   $sk)
static

Convert an Ed25519 secret key to a Curve25519 secret key

Paramètres
string$sk
Renvoie
string
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références Sodium\CRYPTO_SIGN_SEEDBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), ParagonIE_Sodium_Core_Util\intToChr(), ParagonIE_Sodium_Core_Util\strlen(), et ParagonIE_Sodium_Core_Util\substr().

◆ crypto_sign_keypair()

static crypto_sign_keypair ( )
static

Generate a new random Ed25519 keypair.

Renvoie
string
Exceptions
SodiumException
TypeError

Références ParagonIE_Sodium_Core32_Ed25519\keypair(), et ParagonIE_Sodium_Core_Ed25519\keypair().

◆ crypto_sign_keypair_from_secretkey_and_publickey()

static crypto_sign_keypair_from_secretkey_and_publickey (   $sk,
  $pk 
)
static
Paramètres
string$sk
string$pk
Renvoie
string
Exceptions
SodiumException

Références Sodium\CRYPTO_SIGN_PUBLICKEYBYTES, Sodium\CRYPTO_SIGN_SECRETKEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_sign_open()

static crypto_sign_open (   $signedMessage,
  $publicKey 
)
static

Validates a signed message then returns the message.

Paramètres
string$signedMessageA signed message
string$publicKeyA public key
Renvoie
string The original message (if the signature is valid for this public key)
Exceptions
SodiumException
TypeError-suppress MixedArgument -suppress MixedInferredReturnType -suppress MixedReturnStatement

-suppress InvalidReturnStatement -suppress FalsableReturnStatement

Références Sodium\CRYPTO_SIGN_BYTES, Sodium\CRYPTO_SIGN_PUBLICKEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), ParagonIE_Sodium_Crypto32\sign_open(), ParagonIE_Sodium_Crypto\sign_open(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_sign_publickey()

static crypto_sign_publickey (   $keypair)
static

Extract an Ed25519 public key from an Ed25519 keypair.

Paramètres
string$keypairKeypair
Renvoie
string Public key
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références Sodium\CRYPTO_SIGN_KEYPAIRBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), ParagonIE_Sodium_Core32_Ed25519\publickey(), ParagonIE_Sodium_Core_Ed25519\publickey(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_sign_publickey_from_secretkey()

static crypto_sign_publickey_from_secretkey (   $secretKey)
static

Calculate an Ed25519 public key from an Ed25519 secret key.

Paramètres
string$secretKeyYour Ed25519 secret key
Renvoie
string The corresponding Ed25519 public key
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références Sodium\CRYPTO_SIGN_SECRETKEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_sign_secretkey()

static crypto_sign_secretkey (   $keypair)
static

Extract an Ed25519 secret key from an Ed25519 keypair.

Paramètres
string$keypairKeypair
Renvoie
string Secret key
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références Sodium\CRYPTO_SIGN_KEYPAIRBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), ParagonIE_Sodium_Core32_Ed25519\secretkey(), ParagonIE_Sodium_Core_Ed25519\secretkey(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_sign_seed_keypair()

static crypto_sign_seed_keypair (   $seed)
static

Generate an Ed25519 keypair from a seed.

Paramètres
string$seedInput seed
Renvoie
string Keypair
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références ParagonIE_Sodium_Core_Util\declareScalarType().

◆ crypto_sign_verify_detached()

static crypto_sign_verify_detached (   $signature,
  $message,
  $publicKey 
)
static

Verify the Ed25519 signature of a message.

Paramètres
string$signatureDigital sginature
string$messageMessage to be verified
string$publicKeyPublic key
Renvoie
bool TRUE if this signature is good for this public key; FALSE otherwise
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $message, Sodium\CRYPTO_SIGN_BYTES, Sodium\CRYPTO_SIGN_PUBLICKEYBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), ParagonIE_Sodium_Crypto32\sign_verify_detached(), ParagonIE_Sodium_Crypto\sign_verify_detached(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_stream()

static crypto_stream (   $len,
  $nonce,
  $key 
)
static

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

Paramètres
int$lenNumber of bytes desired
string$nonceNumber to be used Once; must be 24 bytes
string$keyXSalsa20 key
Renvoie
string Pseudorandom stream that can be XORed with messages to provide encryption (but not authentication; see Poly1305 or crypto_auth() for that, which is not optional for security)
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $key, Sodium\CRYPTO_STREAM_KEYBYTES, Sodium\CRYPTO_STREAM_NONCEBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), ParagonIE_Sodium_Core_Util\strlen(), ParagonIE_Sodium_Core32_XSalsa20\xsalsa20(), et ParagonIE_Sodium_Core_XSalsa20\xsalsa20().

◆ crypto_stream_keygen()

static crypto_stream_keygen ( )
static

Return a secure random key for use with crypto_stream

Renvoie
string
Exceptions
Exception
Error

Références Sodium\CRYPTO_STREAM_KEYBYTES.

◆ crypto_stream_xchacha20()

static crypto_stream_xchacha20 (   $len,
  $nonce,
  $key,
  $dontFallback = false 
)
static

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

Paramètres
int$lenNumber of bytes desired
string$nonceNumber to be used Once; must be 24 bytes
string$keyXChaCha20 key
bool$dontFallback
Renvoie
string Pseudorandom stream that can be XORed with messages to provide encryption (but not authentication; see Poly1305 or crypto_auth() for that, which is not optional for security)
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $key, ParagonIE_Sodium_Core_Util\declareScalarType(), ParagonIE_Sodium_Core32_XChaCha20\stream(), ParagonIE_Sodium_Core_XChaCha20\stream(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_stream_xchacha20_keygen()

static crypto_stream_xchacha20_keygen ( )
static

Return a secure random key for use with crypto_stream_xchacha20

Renvoie
string
Exceptions
Exception
Error

◆ crypto_stream_xchacha20_xor()

static crypto_stream_xchacha20_xor (   $message,
  $nonce,
  $key,
  $dontFallback = false 
)
static

DANGER! UNAUTHENTICATED ENCRYPTION!

Unless you are following expert advice, do not use this feature.

Algorithm: XChaCha20

This DOES NOT provide ciphertext integrity.

Paramètres
string$messagePlaintext message
string$nonceNumber to be used Once; must be 24 bytes
string$keyEncryption key
Renvoie
string Encrypted text which is vulnerable to chosen- ciphertext attacks unless you implement some other mitigation to the ciphertext (i.e. Encrypt then MAC)
Paramètres
bool$dontFallback
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $key, $message, ParagonIE_Sodium_Core_Util\declareScalarType(), ParagonIE_Sodium_Core32_XChaCha20\streamXorIc(), ParagonIE_Sodium_Core_XChaCha20\streamXorIc(), et ParagonIE_Sodium_Core_Util\strlen().

◆ crypto_stream_xor()

static crypto_stream_xor (   $message,
  $nonce,
  $key 
)
static

DANGER! UNAUTHENTICATED ENCRYPTION!

Unless you are following expert advice, do not use this feature.

Algorithm: XSalsa20

This DOES NOT provide ciphertext integrity.

Paramètres
string$messagePlaintext message
string$nonceNumber to be used Once; must be 24 bytes
string$keyEncryption key
Renvoie
string Encrypted text which is vulnerable to chosen- ciphertext attacks unless you implement some other mitigation to the ciphertext (i.e. Encrypt then MAC)
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $key, $message, Sodium\CRYPTO_STREAM_KEYBYTES, Sodium\CRYPTO_STREAM_NONCEBYTES, ParagonIE_Sodium_Core_Util\declareScalarType(), ParagonIE_Sodium_Core_Util\strlen(), ParagonIE_Sodium_Core32_XSalsa20\xsalsa20_xor(), et ParagonIE_Sodium_Core_XSalsa20\xsalsa20_xor().

◆ hex2bin()

static hex2bin (   $string)
static

Cache-timing-safe implementation of hex2bin().

Paramètres
string$stringHexadecimal string
Renvoie
string Raw binary string
Exceptions
SodiumException
TypeError-suppress TooFewArguments -suppress MixedArgument

Références ParagonIE_Sodium_Core_Util\declareScalarType().

◆ increment()

static increment ( $var)
static

Increase a string (little endian)

Paramètres
string$var
Renvoie
void
Exceptions
SodiumException
TypeError-suppress MixedArgument

Références $i, ParagonIE_Sodium_Core_Util\declareScalarType(), ParagonIE_Sodium_Core_Util\intToChr(), ParagonIE_Sodium_Core_Util\strlen(), et ParagonIE_Sodium_Core_Util\substr().

◆ is_zero()

static is_zero (   $str)
static

◆ library_version_major()

static library_version_major ( )
static

The equivalent to the libsodium minor version we aim to be compatible with (sans pwhash and memzero).

Renvoie
int

-suppress UndefinedFunction

Références SODIUM_LIBRARY_MAJOR_VERSION.

◆ library_version_minor()

static library_version_minor ( )
static

The equivalent to the libsodium minor version we aim to be compatible with (sans pwhash and memzero).

Renvoie
int

-suppress UndefinedFunction

Références SODIUM_LIBRARY_MINOR_VERSION.

◆ memzero()

static memzero ( $var)
static

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

Paramètres
string | null$var
-outstring|null $var
Renvoie
void
Exceptions
SodiumException(Unless libsodium is installed)
TypeError-suppress TooFewArguments

-suppress MixedArgument

Références ParagonIE_Sodium_Core_Util\declareScalarType(), et null.

Référencé par ParagonIE_Sodium_Core_Salsa20\salsa20(), ParagonIE_Sodium_Core32_Salsa20\salsa20(), ParagonIE_Sodium_Core_Salsa20\salsa20_xor_ic(), ParagonIE_Sodium_Core32_Salsa20\salsa20_xor_ic(), ParagonIE_Sodium_Core_Ed25519\sign_detached(), et ParagonIE_Sodium_Core32_Ed25519\sign_detached().

◆ polyfill_is_fast()

static polyfill_is_fast ( )
static

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

Renvoie
bool

◆ randombytes_random16()

static randombytes_random16 ( )
static

Generate a random 16-bit integer.

Renvoie
int
Exceptions
Exception
Error
TypeError

◆ randombytes_uniform()

static randombytes_uniform (   $range)
static

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

Paramètres
int$range
Renvoie
int
Exceptions
Exception
Error
TypeError

Références $range.

◆ ristretto255_add()

static ristretto255_add (   $p,
  $q,
  $dontFallback = false 
)
static
Paramètres
string$p
string$q
bool$dontFallback
Renvoie
string
Exceptions
SodiumException

Références ParagonIE_Sodium_Core_Ristretto255\ristretto255_add().

◆ ristretto255_from_hash()

static ristretto255_from_hash (   $r,
  $dontFallback = false 
)
static
Paramètres
string$r
bool$dontFallback
Renvoie
string
Exceptions
SodiumException

Références $r, et ParagonIE_Sodium_Core_Ristretto255\ristretto255_from_hash().

◆ ristretto255_is_valid_point()

static ristretto255_is_valid_point (   $p,
  $dontFallback = false 
)
static
Paramètres
string$p
bool$dontFallback
Renvoie
bool
Exceptions
SodiumException

Références $r, ParagonIE_Sodium_Core_Ristretto255\ristretto255_frombytes(), et ParagonIE_Sodium_Core_Ristretto255\ristretto255_point_is_canonical().

◆ ristretto255_random()

static ristretto255_random (   $dontFallback = false)
static
Paramètres
bool$dontFallback
Renvoie
string
Exceptions
SodiumException

Références ParagonIE_Sodium_Core_Ristretto255\ristretto255_random().

◆ ristretto255_scalar_add()

static ristretto255_scalar_add (   $x,
  $y,
  $dontFallback = false 
)
static
Paramètres
string$x
string$y
bool$dontFallback
Renvoie
string
Exceptions
SodiumException

Références ParagonIE_Sodium_Core_Ristretto255\ristretto255_scalar_add().

◆ ristretto255_scalar_complement()

static ristretto255_scalar_complement (   $s,
  $dontFallback = false 
)
static
Paramètres
string$s
bool$dontFallback
Renvoie
string
Exceptions
SodiumException

Références ParagonIE_Sodium_Core_Ristretto255\ristretto255_scalar_complement().

◆ ristretto255_scalar_invert()

static ristretto255_scalar_invert (   $s,
  $dontFallback = false 
)
static
Paramètres
string$s
bool$dontFallback
Renvoie
string
Exceptions
SodiumException

Références ParagonIE_Sodium_Core_Ristretto255\ristretto255_scalar_invert().

◆ ristretto255_scalar_mul()

static ristretto255_scalar_mul (   $x,
  $y,
  $dontFallback = false 
)
static
Paramètres
string$x
string$y
bool$dontFallback
Renvoie
string
Exceptions
SodiumException

Références ParagonIE_Sodium_Core_Ristretto255\ristretto255_scalar_mul().

◆ ristretto255_scalar_negate()

static ristretto255_scalar_negate (   $s,
  $dontFallback = false 
)
static
Paramètres
string$s
bool$dontFallback
Renvoie
string
Exceptions
SodiumException

Références ParagonIE_Sodium_Core_Ristretto255\ristretto255_scalar_negate().

◆ ristretto255_scalar_random()

static ristretto255_scalar_random (   $dontFallback = false)
static
Paramètres
bool$dontFallback
Renvoie
string
Exceptions
SodiumException

Références ParagonIE_Sodium_Core_Ristretto255\ristretto255_scalar_random().

◆ ristretto255_scalar_reduce()

static ristretto255_scalar_reduce (   $s,
  $dontFallback = false 
)
static
Paramètres
string$s
bool$dontFallback
Renvoie
string
Exceptions
SodiumException

◆ ristretto255_scalar_sub()

static ristretto255_scalar_sub (   $x,
  $y,
  $dontFallback = false 
)
static
Paramètres
string$x
string$y
bool$dontFallback
Renvoie
string
Exceptions
SodiumException

Références ParagonIE_Sodium_Core_Ristretto255\ristretto255_scalar_sub().

◆ ristretto255_sub()

static ristretto255_sub (   $p,
  $q,
  $dontFallback = false 
)
static
Paramètres
string$p
string$q
bool$dontFallback
Renvoie
string
Exceptions
SodiumException

Références ParagonIE_Sodium_Core_Ristretto255\ristretto255_sub().

◆ scalarmult_ristretto255()

static scalarmult_ristretto255 (   $n,
  $p,
  $dontFallback = false 
)
static
Paramètres
string$n
string$p
bool$dontFallback
Renvoie
string
Exceptions
SodiumException

Références $n, et ParagonIE_Sodium_Core_Ristretto255\scalarmult_ristretto255().

◆ scalarmult_ristretto255_base()

static scalarmult_ristretto255_base (   $n,
  $dontFallback = false 
)
static
Paramètres
string$n
string$p
bool$dontFallback
Renvoie
string
Exceptions
SodiumException

Références $n, et ParagonIE_Sodium_Core_Ristretto255\scalarmult_ristretto255_base().

◆ sub()

static sub ( $val,
  $addv 
)
static

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

This mutates $val.

Paramètres
string$val
string$addv
Renvoie
void
Exceptions
SodiumException

Références $i, et ParagonIE_Sodium_Core_Util\strlen().

Référencé par ParagonIE_Sodium_Core_Ed25519\scalar_complement(), et ParagonIE_Sodium_Core_Ed25519\scalar_negate().

◆ unpad()

static unpad (   $padded,
  $blockSize,
  $dontFallback = false 
)
static
Paramètres
string$padded
int$blockSize
bool$dontFallback
Renvoie
string
Exceptions
SodiumException

Références $i, ParagonIE_Sodium_Core_Util\declareScalarType(), ParagonIE_Sodium_Core_Util\strlen(), et ParagonIE_Sodium_Core_Util\substr().

◆ use_fallback()

static use_fallback (   $sodium_func_name = '')
staticprotected

Should we use the libsodium core function instead? This is always a good idea, if it's available. (Unless we're in the middle of running our unit test suite.)

If ext/libsodium is available, use it. Return TRUE. Otherwise, we have to use the code provided herein. Return FALSE.

Paramètres
string$sodium_func_name
Renvoie
bool

Références null.

◆ useNewSodiumAPI()

static useNewSodiumAPI ( )
staticprotected

Libsodium as implemented in PHP 7.2 and/or ext/sodium (via PECL)

https://wiki.php.net/rfc/libsodium

Renvoie
bool

Références null.

◆ version_string()

static version_string ( )
static

This emulates libsodium's version_string() function, except ours is prefixed with 'polyfill-'.

Renvoie
string -suppress MixedInferredReturnType -suppress UndefinedFunction

Documentation des champs

◆ $disableFallbackForUnitTests

$disableFallbackForUnitTests = false
static

◆ $fastMult

$fastMult = false
static

◆ BASE64_VARIANT_ORIGINAL

const BASE64_VARIANT_ORIGINAL = 1

◆ BASE64_VARIANT_ORIGINAL_NO_PADDING

const BASE64_VARIANT_ORIGINAL_NO_PADDING = 3

◆ BASE64_VARIANT_URLSAFE

const BASE64_VARIANT_URLSAFE = 5

◆ BASE64_VARIANT_URLSAFE_NO_PADDING

const BASE64_VARIANT_URLSAFE_NO_PADDING = 7

◆ CRYPTO_AEAD_AES256GCM_ABYTES

const CRYPTO_AEAD_AES256GCM_ABYTES = 16

◆ CRYPTO_AEAD_AES256GCM_KEYBYTES

const CRYPTO_AEAD_AES256GCM_KEYBYTES = 32

◆ CRYPTO_AEAD_AES256GCM_NPUBBYTES

const CRYPTO_AEAD_AES256GCM_NPUBBYTES = 12

◆ CRYPTO_AEAD_AES256GCM_NSECBYTES

const CRYPTO_AEAD_AES256GCM_NSECBYTES = 0

◆ CRYPTO_AEAD_CHACHA20POLY1305_ABYTES

const CRYPTO_AEAD_CHACHA20POLY1305_ABYTES = 16

◆ CRYPTO_AEAD_CHACHA20POLY1305_IETF_ABYTES

const CRYPTO_AEAD_CHACHA20POLY1305_IETF_ABYTES = 16

◆ CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES

const CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES = 32

◆ CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES

const CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES = 12

◆ CRYPTO_AEAD_CHACHA20POLY1305_IETF_NSECBYTES

const CRYPTO_AEAD_CHACHA20POLY1305_IETF_NSECBYTES = 0

◆ CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES

const CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES = 32

◆ CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES

const CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES = 8

◆ CRYPTO_AEAD_CHACHA20POLY1305_NSECBYTES

const CRYPTO_AEAD_CHACHA20POLY1305_NSECBYTES = 0

◆ CRYPTO_AEAD_XCHACHA20POLY1305_IETF_ABYTES

const CRYPTO_AEAD_XCHACHA20POLY1305_IETF_ABYTES = 16

◆ CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES

const CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES = 32

◆ CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES

const CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES = 24

◆ CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NSECBYTES

const CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NSECBYTES = 0

◆ CRYPTO_AUTH_BYTES

const CRYPTO_AUTH_BYTES = 32

◆ CRYPTO_AUTH_KEYBYTES

const CRYPTO_AUTH_KEYBYTES = 32

◆ CRYPTO_BOX_KEYPAIRBYTES

const CRYPTO_BOX_KEYPAIRBYTES = 64

◆ CRYPTO_BOX_MACBYTES

const CRYPTO_BOX_MACBYTES = 16

◆ CRYPTO_BOX_NONCEBYTES

const CRYPTO_BOX_NONCEBYTES = 24

◆ CRYPTO_BOX_PUBLICKEYBYTES

const CRYPTO_BOX_PUBLICKEYBYTES = 32

◆ CRYPTO_BOX_SEALBYTES

const CRYPTO_BOX_SEALBYTES = 16

◆ CRYPTO_BOX_SECRETKEYBYTES

◆ CRYPTO_BOX_SEEDBYTES

const CRYPTO_BOX_SEEDBYTES = 32

◆ CRYPTO_CORE_RISTRETTO255_BYTES

const CRYPTO_CORE_RISTRETTO255_BYTES = 32

◆ CRYPTO_CORE_RISTRETTO255_HASHBYTES

const CRYPTO_CORE_RISTRETTO255_HASHBYTES = 64

◆ CRYPTO_CORE_RISTRETTO255_NONREDUCEDSCALARBYTES

const CRYPTO_CORE_RISTRETTO255_NONREDUCEDSCALARBYTES = 64

◆ CRYPTO_CORE_RISTRETTO255_SCALARBYTES

const CRYPTO_CORE_RISTRETTO255_SCALARBYTES = 32

◆ CRYPTO_GENERICHASH_BYTES

const CRYPTO_GENERICHASH_BYTES = 32

◆ CRYPTO_GENERICHASH_BYTES_MAX

const CRYPTO_GENERICHASH_BYTES_MAX = 64

◆ CRYPTO_GENERICHASH_BYTES_MIN

const CRYPTO_GENERICHASH_BYTES_MIN = 16

◆ CRYPTO_GENERICHASH_KEYBYTES

const CRYPTO_GENERICHASH_KEYBYTES = 32

◆ CRYPTO_GENERICHASH_KEYBYTES_MAX

const CRYPTO_GENERICHASH_KEYBYTES_MAX = 64

◆ CRYPTO_GENERICHASH_KEYBYTES_MIN

const CRYPTO_GENERICHASH_KEYBYTES_MIN = 16

◆ CRYPTO_KDF_BYTES_MAX

const CRYPTO_KDF_BYTES_MAX = 64

◆ CRYPTO_KDF_BYTES_MIN

const CRYPTO_KDF_BYTES_MIN = 16

◆ CRYPTO_KDF_CONTEXTBYTES

const CRYPTO_KDF_CONTEXTBYTES = 8

◆ CRYPTO_KDF_KEYBYTES

const CRYPTO_KDF_KEYBYTES = 32

◆ CRYPTO_KX_BYTES

const CRYPTO_KX_BYTES = 32

◆ CRYPTO_KX_KEYPAIRBYTES

const CRYPTO_KX_KEYPAIRBYTES = 64

◆ CRYPTO_KX_PRIMITIVE

const CRYPTO_KX_PRIMITIVE = 'x25519blake2b'

◆ CRYPTO_KX_PUBLICKEYBYTES

const CRYPTO_KX_PUBLICKEYBYTES = 32

◆ CRYPTO_KX_SECRETKEYBYTES

const CRYPTO_KX_SECRETKEYBYTES = 32

◆ CRYPTO_KX_SEEDBYTES

const CRYPTO_KX_SEEDBYTES = 32

◆ CRYPTO_KX_SESSIONKEYBYTES

const CRYPTO_KX_SESSIONKEYBYTES = 32

◆ CRYPTO_PWHASH_ALG_ARGON2I13

const CRYPTO_PWHASH_ALG_ARGON2I13 = 1

◆ CRYPTO_PWHASH_ALG_ARGON2ID13

const CRYPTO_PWHASH_ALG_ARGON2ID13 = 2

◆ CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE

const CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE = 33554432

◆ CRYPTO_PWHASH_MEMLIMIT_MODERATE

const CRYPTO_PWHASH_MEMLIMIT_MODERATE = 134217728

◆ CRYPTO_PWHASH_MEMLIMIT_SENSITIVE

const CRYPTO_PWHASH_MEMLIMIT_SENSITIVE = 536870912

◆ CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE

const CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE = 4

◆ CRYPTO_PWHASH_OPSLIMIT_MODERATE

const CRYPTO_PWHASH_OPSLIMIT_MODERATE = 6

◆ CRYPTO_PWHASH_OPSLIMIT_SENSITIVE

const CRYPTO_PWHASH_OPSLIMIT_SENSITIVE = 8

◆ CRYPTO_PWHASH_SALTBYTES

const CRYPTO_PWHASH_SALTBYTES = 16

◆ CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE

const CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE = 16777216

◆ CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_SENSITIVE

const CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_SENSITIVE = 1073741824

◆ CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_INTERACTIVE

const CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_INTERACTIVE = 534288

◆ CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_SENSITIVE

const CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_SENSITIVE = 33554432

◆ CRYPTO_PWHASH_SCRYPTSALSA208SHA256_SALTBYTES

const CRYPTO_PWHASH_SCRYPTSALSA208SHA256_SALTBYTES = 32

◆ CRYPTO_PWHASH_SCRYPTSALSA208SHA256_STRPREFIX

const CRYPTO_PWHASH_SCRYPTSALSA208SHA256_STRPREFIX = '$7$'

◆ CRYPTO_PWHASH_STRPREFIX

const CRYPTO_PWHASH_STRPREFIX = '$argon2id$'

◆ CRYPTO_SCALARMULT_BYTES

const CRYPTO_SCALARMULT_BYTES = 32

◆ CRYPTO_SCALARMULT_RISTRETTO255_BYTES

const CRYPTO_SCALARMULT_RISTRETTO255_BYTES = 32

◆ CRYPTO_SCALARMULT_RISTRETTO255_SCALARBYTES

const CRYPTO_SCALARMULT_RISTRETTO255_SCALARBYTES = 32

◆ CRYPTO_SCALARMULT_SCALARBYTES

const CRYPTO_SCALARMULT_SCALARBYTES = 32

◆ CRYPTO_SECRETBOX_KEYBYTES

const CRYPTO_SECRETBOX_KEYBYTES = 32

◆ CRYPTO_SECRETBOX_MACBYTES

const CRYPTO_SECRETBOX_MACBYTES = 16

◆ CRYPTO_SECRETBOX_NONCEBYTES

const CRYPTO_SECRETBOX_NONCEBYTES = 24

◆ CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_ABYTES

const CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_ABYTES = 17

◆ CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES

const CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES = 24

◆ CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES

const CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES = 32

◆ CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_MESSAGEBYTES_MAX

const CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_MESSAGEBYTES_MAX = 0x3fffffff80

◆ CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_FINAL

const CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_FINAL = 3

◆ CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PULL

const CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PULL = 1

◆ CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PUSH

const CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PUSH = 0

◆ CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_REKEY

const CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_REKEY = 2

◆ CRYPTO_SHORTHASH_BYTES

const CRYPTO_SHORTHASH_BYTES = 8

◆ CRYPTO_SHORTHASH_KEYBYTES

const CRYPTO_SHORTHASH_KEYBYTES = 16

◆ CRYPTO_SIGN_BYTES

const CRYPTO_SIGN_BYTES = 64

◆ CRYPTO_SIGN_KEYPAIRBYTES

const CRYPTO_SIGN_KEYPAIRBYTES = 96

◆ CRYPTO_SIGN_PUBLICKEYBYTES

const CRYPTO_SIGN_PUBLICKEYBYTES = 32

◆ CRYPTO_SIGN_SECRETKEYBYTES

const CRYPTO_SIGN_SECRETKEYBYTES = 64

◆ CRYPTO_SIGN_SEEDBYTES

const CRYPTO_SIGN_SEEDBYTES = 32

◆ CRYPTO_STREAM_KEYBYTES

const CRYPTO_STREAM_KEYBYTES = 32

◆ CRYPTO_STREAM_NONCEBYTES

const CRYPTO_STREAM_NONCEBYTES = 24

◆ CRYPTO_STREAM_XCHACHA20_KEYBYTES

const CRYPTO_STREAM_XCHACHA20_KEYBYTES = 32

◆ CRYPTO_STREAM_XCHACHA20_NONCEBYTES

const CRYPTO_STREAM_XCHACHA20_NONCEBYTES = 24

◆ LIBRARY_MAJOR_VERSION

const LIBRARY_MAJOR_VERSION = 9

◆ LIBRARY_MINOR_VERSION

const LIBRARY_MINOR_VERSION = 1

◆ LIBRARY_VERSION_MAJOR

const LIBRARY_VERSION_MAJOR = 9

◆ LIBRARY_VERSION_MINOR

const LIBRARY_VERSION_MINOR = 1

◆ VERSION_STRING

const VERSION_STRING = 'polyfill-1.0.8'

La documentation de cette classe a été générée à partir du fichier suivant :