ParagonIE_Sodium_Compat

package

Default

Methods

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

add(string &$val,string $addv): void
static

This mutates $val.

Throws
\SodiumException

Arguments

$val

string

$addv

string

base642bin

base642bin(string $encoded,integer $variant,string $ignore = ''): string
static
Throws
\SodiumException

Arguments

$encoded

string

$variant

integer

$ignore

string

Response

string

bin2base64

bin2base64(string $decoded,integer $variant): string
static
Throws
\SodiumException

Arguments

$decoded

string

$variant

integer

Response

string

Cache-timing-safe implementation of bin2hex().

bin2hex(string $string): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$string

string

A string (probably raw binary)

Response

string

A hexadecimal-encoded string

Compare two strings, in constant-time.

compare(string $left,string $right): integer
static

Compared to memcmp(), compare() is more useful for sorting.

psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$left

string

The left operand; must be a string

$right

string

The right operand; must be a string

Response

integer

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

Authenticated Encryption with Associated Data: Decryption

crypto_aead_aes256gcm_decrypt(string $ciphertext = '',string $assocData = '',string $nonce = '',string $key = ''): string|boolean
static

Algorithm: AES-256-GCM

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.

psalm-suppress

MixedArgument

MixedInferredReturnType

MixedReturnStatement

Throws
\SodiumException
\TypeError

Arguments

$ciphertext

string

Encrypted message (with Poly1305 MAC appended)

$assocData

string

Authenticated Associated Data (unencrypted)

$nonce

string

Number to be used only Once; must be 8 bytes

$key

string

Encryption key

Response

string|boolean

The original plaintext message

Authenticated Encryption with Associated Data: Encryption

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

Algorithm: AES-256-GCM

psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$plaintext

string

Message to be encrypted

$assocData

string

Authenticated Associated Data (unencrypted)

$nonce

string

Number to be used only Once; must be 8 bytes

$key

string

Encryption key

Response

string

Ciphertext with a 16-byte GCM message authentication code appended

Is AES-256-GCM even available to use?

crypto_aead_aes256gcm_is_available(): boolean
static
psalm-suppress

UndefinedFunction

MixedInferredReturnType

MixedReturnStatement

Response

boolean

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

crypto_aead_aes256gcm_keygen(): string
static
Throws
\Exception
\Error

Response

string

Authenticated Encryption with Associated Data: Decryption

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

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.

psalm-suppress

MixedArgument

MixedInferredReturnType

MixedReturnStatement

Throws
\SodiumException
\TypeError

Arguments

$ciphertext

string

Encrypted message (with Poly1305 MAC appended)

$assocData

string

Authenticated Associated Data (unencrypted)

$nonce

string

Number to be used only Once; must be 8 bytes

$key

string

Encryption key

Response

string

The original plaintext message

Authenticated Encryption with Associated Data

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

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.

psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$plaintext

string

Message to be encrypted

$assocData

string

Authenticated Associated Data (unencrypted)

$nonce

string

Number to be used only Once; must be 8 bytes

$key

string

Encryption key

Response

string

Ciphertext with a 16-byte Poly1305 message authentication code appended

Authenticated Encryption with Associated Data: Decryption

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

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.

psalm-suppress

MixedArgument

MixedInferredReturnType

MixedReturnStatement

Throws
\SodiumException
\TypeError

Arguments

$ciphertext

string

Encrypted message (with Poly1305 MAC appended)

$assocData

string

Authenticated Associated Data (unencrypted)

$nonce

string

Number to be used only Once; must be 12 bytes

$key

string

Encryption key

Response

string

The original plaintext message

Authenticated Encryption with Associated Data

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

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.

psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$plaintext

string

Message to be encrypted

$assocData

string

Authenticated Associated Data (unencrypted)

$nonce

string

Number to be used only Once; must be 8 bytes

$key

string

Encryption key

Response

string

Ciphertext with a 16-byte Poly1305 message authentication code appended

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

crypto_aead_chacha20poly1305_ietf_keygen(): string
static
Throws
\Exception
\Error

Response

string

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

crypto_aead_chacha20poly1305_keygen(): string
static
Throws
\Exception
\Error

Response

string

Authenticated Encryption with Associated Data: Decryption

crypto_aead_xchacha20poly1305_ietf_decrypt(string $ciphertext = '',string $assocData = '',string $nonce = '',string $key = '',boolean $dontFallback = false): string|boolean
static

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.

psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$ciphertext

string

Encrypted message (with Poly1305 MAC appended)

$assocData

string

Authenticated Associated Data (unencrypted)

$nonce

string

Number to be used only Once; must be 8 bytes

$key

string

Encryption key

$dontFallback

boolean

Don't fallback to ext/sodium

Response

string|boolean

The original plaintext message

Authenticated Encryption with Associated Data

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

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.

psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$plaintext

string

Message to be encrypted

$assocData

string

Authenticated Associated Data (unencrypted)

$nonce

string

Number to be used only Once; must be 8 bytes

$key

string

Encryption key

$dontFallback

boolean

Don't fallback to ext/sodium

Response

string

Ciphertext with a 16-byte Poly1305 message authentication code appended

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

crypto_aead_xchacha20poly1305_ietf_keygen(): string
static
Throws
\Exception
\Error

Response

string

Authenticate a message. Uses symmetric-key cryptography.

crypto_auth(string $message,string $key): string
static

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).

psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$message

string

Message to be authenticated

$key

string

Symmetric authentication key

Response

string

Message authentication code

crypto_auth_keygen

crypto_auth_keygen(): string
static
Throws
\Exception
\Error

Response

string

Verify the MAC of a message previously authenticated with crypto_auth.

crypto_auth_verify(string $mac,string $message,string $key): boolean
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$mac

string

Message authentication code

$message

string

Message whose authenticity you are attempting to verify (with a given MAC and key)

$key

string

Symmetric authentication key

Response

boolean

TRUE if authenticated, FALSE otherwise

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

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

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.

psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$plaintext

string

The message to be encrypted

$nonce

string

A Number to only be used Once; must be 24 bytes

$keypair

string

Your secret key and your recipient's public key

Response

string

Ciphertext with 16-byte Poly1305 MAC

Generate a new random X25519 keypair.

crypto_box_keypair(): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Response

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!

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.

crypto_box_keypair_from_secretkey_and_publickey(string $secretKey,string $publicKey): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$secretKey

string

Secret key

$publicKey

string

Public key

Response

string

Keypair

Decrypt a message previously encrypted with crypto_box().

crypto_box_open(string $ciphertext,string $nonce,string $keypair): string
static
psalm-suppress

MixedArgument

MixedInferredReturnType

MixedReturnStatement

Throws
\SodiumException
\TypeError

Arguments

$ciphertext

string

Encrypted message

$nonce

string

Number to only be used Once; must be 24 bytes

$keypair

string

Your secret key and the sender's public key

Response

string

The original plaintext message

Extract the public key from a crypto_box keypair.

crypto_box_publickey(string $keypair): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$keypair

string

Keypair containing secret and public key

Response

string

Your crypto_box public key

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

crypto_box_publickey_from_secretkey(string $secretKey): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$secretKey

string

Any X25519 secret key

Response

string

The corresponding X25519 public key

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

crypto_box_seal(string $plaintext,string $publicKey): string
static

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.

psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$plaintext

string

Message to be sealed

$publicKey

string

Your recipient's public key

Response

string

Sealed message that only your recipient can decrypt

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

crypto_box_seal_open(string $ciphertext,string $keypair): string
static

This validates ciphertext integrity.

psalm-suppress

MixedArgument

MixedInferredReturnType

MixedReturnStatement

Throws
\SodiumException
\TypeError

Arguments

$ciphertext

string

Sealed message to be opened

$keypair

string

Your crypto_box keypair

Response

string

The original plaintext message

Extract the secret key from a crypto_box keypair.

crypto_box_secretkey(string $keypair): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$keypair

string

Response

string

Your crypto_box secret key

Generate an X25519 keypair from a seed.

crypto_box_seed_keypair(string $seed): string
static
psalm-suppress

MixedArgument

UndefinedFunction

Throws
\SodiumException
\TypeError

Arguments

$seed

string

Response

string

Calculates a BLAKE2b hash, with an optional key.

crypto_generichash(string $message,string|null $key = '',integer $length = self::CRYPTO_GENERICHASH_BYTES): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$message

string

The message to be hashed

$key

string|null

If specified, must be a string between 16 and 64 bytes long

$length

integer

Output length in bytes; must be between 16 and 64 (default = 32)

Response

string

Raw binary

Get the final BLAKE2b hash output for a given context.

crypto_generichash_final(string &$ctx,integer $length = self::CRYPTO_GENERICHASH_BYTES): string
static
psalm-suppress

MixedArgument

ReferenceConstraintViolation

ConflictingReferenceConstraint

Throws
\SodiumException
\TypeError

Arguments

$ctx

string

BLAKE2 hashing context. Generated by crypto_generichash_init().

$length

integer

Hash output size.

Response

string

Final BLAKE2b hash.

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

crypto_generichash_init(string|null $key = '',integer $length = self::CRYPTO_GENERICHASH_BYTES): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$key

string|null

If specified must be a string between 16 and 64 bytes

$length

integer

The size of the desired hash output

Response

string

A BLAKE2 hashing context, encoded as a string (To be 100% compatible with ext/libsodium)

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

crypto_generichash_init_salt_personal(string|null $key = '',integer $length = self::CRYPTO_GENERICHASH_BYTES,string $salt = '',string $personal = ''): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$key

string|null

If specified must be a string between 16 and 64 bytes

$length

integer

The size of the desired hash output

$salt

string

Salt (up to 16 bytes)

$personal

string

Personalization string (up to 16 bytes)

Response

string

A BLAKE2 hashing context, encoded as a string (To be 100% compatible with ext/libsodium)

crypto_generichash_keygen

crypto_generichash_keygen(): string
static
Throws
\Exception
\Error

Response

string

Update a BLAKE2b hashing context with additional data.

crypto_generichash_update(string &$ctx,string $message): void
static
param-out

string $ctx

psalm-suppress

MixedArgument

ReferenceConstraintViolation

Throws
\SodiumException
\TypeError

Arguments

$ctx

string

BLAKE2 hashing context. Generated by crypto_generichash_init(). $ctx is passed by reference and gets updated in-place.

$message

string

The message to append to the existing hash state.

crypto_kdf_derive_from_key

crypto_kdf_derive_from_key(integer $subkey_len,integer $subkey_id,string $context,string $key): string
static
Throws
\SodiumException

Arguments

$subkey_len

integer

$subkey_id

integer

$context

string

$key

string

Response

string

crypto_kdf_keygen

crypto_kdf_keygen(): string
static
Throws
\Exception
\Error

Response

string

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

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

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.

psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$my_secret

string

$their_public

string

$client_public

string

$server_public

string

$dontFallback

boolean

Response

string

crypto_kx_client_session_keys

crypto_kx_client_session_keys(string $keypair,string $serverPublicKey): \array{0:
static
Throws
\SodiumException

Arguments

$keypair

string

$serverPublicKey

string

Response

\array{0:

string, 1: string}

crypto_kx_keypair

crypto_kx_keypair(): string
static
Throws
\Exception

Response

string

crypto_kx_publickey

crypto_kx_publickey(string $kp): string
static
Throws
\SodiumException

Arguments

$kp

string

Response

string

crypto_kx_secretkey

crypto_kx_secretkey(string $kp): string
static
Throws
\SodiumException

Arguments

$kp

string

Response

string

crypto_kx_seed_keypair

crypto_kx_seed_keypair(string $seed): string
static
Throws
\SodiumException

Arguments

$seed

string

Response

string

crypto_kx_server_session_keys

crypto_kx_server_session_keys(string $keypair,string $clientPublicKey): \array{0:
static
Throws
\SodiumException

Arguments

$keypair

string

$clientPublicKey

string

Response

\array{0:

string, 1: string}

crypto_pwhash

crypto_pwhash(integer $outlen,string $passwd,string $salt,integer $opslimit,integer $memlimit,integer|null $alg = null): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$outlen

integer

$passwd

string

$salt

string

$opslimit

integer

$memlimit

integer

$alg

integer|null

Response

string

!Exclusive to sodium_compat!

crypto_pwhash_is_available(): boolean
static

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

Response

boolean

crypto_pwhash_scryptsalsa208sha256

crypto_pwhash_scryptsalsa208sha256(integer $outlen,string $passwd,string $salt,integer $opslimit,integer $memlimit): string
static
Throws
\SodiumException
\TypeError

Arguments

$outlen

integer

$passwd

string

$salt

string

$opslimit

integer

$memlimit

integer

Response

string

!Exclusive to sodium_compat!

crypto_pwhash_scryptsalsa208sha256_is_available(): boolean
static

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

Response

boolean

crypto_pwhash_scryptsalsa208sha256_str

crypto_pwhash_scryptsalsa208sha256_str(string $passwd,integer $opslimit,integer $memlimit): string
static
Throws
\SodiumException
\TypeError

Arguments

$passwd

string

$opslimit

integer

$memlimit

integer

Response

string

crypto_pwhash_scryptsalsa208sha256_str_verify

crypto_pwhash_scryptsalsa208sha256_str_verify(string $passwd,string $hash): boolean
static
Throws
\SodiumException
\TypeError

Arguments

$passwd

string

$hash

string

Response

boolean

crypto_pwhash_str

crypto_pwhash_str(string $passwd,integer $opslimit,integer $memlimit): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$passwd

string

$opslimit

integer

$memlimit

integer

Response

string

Do we need to rehash this password?

crypto_pwhash_str_needs_rehash(string $hash,integer $opslimit,integer $memlimit): boolean
static
Throws
\SodiumException

Arguments

$hash

string

$opslimit

integer

$memlimit

integer

Response

boolean

crypto_pwhash_str_verify

crypto_pwhash_str_verify(string $passwd,string $hash): boolean
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$passwd

string

$hash

string

Response

boolean

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

crypto_scalarmult(string $secretKey,string $publicKey): string
static

Algorithm: X25519 (ECDH over Curve25519)

psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$secretKey

string

$publicKey

string

Response

string

Calculate an X25519 public key from an X25519 secret key.

crypto_scalarmult_base(string $secretKey): string
static
psalm-suppress

TooFewArguments

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$secretKey

string

Response

string

Authenticated symmetric-key encryption.

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

Algorithm: XSalsa20-Poly1305

psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$plaintext

string

The message you're encrypting

$nonce

string

A Number to be used Once; must be 24 bytes

$key

string

Symmetric encryption key

Response

string

Ciphertext with Poly1305 MAC

Return a secure random key for use with crypto_secretbox

crypto_secretbox_keygen(): string
static
Throws
\Exception
\Error

Response

string

Decrypts a message previously encrypted with crypto_secretbox().

crypto_secretbox_open(string $ciphertext,string $nonce,string $key): string
static
psalm-suppress

MixedArgument

MixedInferredReturnType

MixedReturnStatement

Throws
\SodiumException
\TypeError

Arguments

$ciphertext

string

Ciphertext with Poly1305 MAC

$nonce

string

A Number to be used Once; must be 24 bytes

$key

string

Symmetric encryption key

Response

string

Original plaintext message

Authenticated symmetric-key encryption.

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

Algorithm: XChaCha20-Poly1305

psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$plaintext

string

The message you're encrypting

$nonce

string

A Number to be used Once; must be 24 bytes

$key

string

Symmetric encryption key

Response

string

Ciphertext with Poly1305 MAC

Decrypts a message previously encrypted with crypto_secretbox_xchacha20poly1305().

crypto_secretbox_xchacha20poly1305_open(string $ciphertext,string $nonce,string $key): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$ciphertext

string

Ciphertext with Poly1305 MAC

$nonce

string

A Number to be used Once; must be 24 bytes

$key

string

Symmetric encryption key

Response

string

Original plaintext message

crypto_secretstream_xchacha20poly1305_init_pull

crypto_secretstream_xchacha20poly1305_init_pull(string $header,string $key): string
static
Throws
\Exception

Arguments

$header

string

$key

string

Response

string

Returns a state.

crypto_secretstream_xchacha20poly1305_init_push

crypto_secretstream_xchacha20poly1305_init_push(string $key): \array<int,
static
Throws
\Exception
\SodiumException

Arguments

$key

string

Response

\array

string> Returns a state and a header.

crypto_secretstream_xchacha20poly1305_keygen

crypto_secretstream_xchacha20poly1305_keygen(): string
static
Throws
\Exception

Response

string

crypto_secretstream_xchacha20poly1305_pull

crypto_secretstream_xchacha20poly1305_pull(string &$state,string $msg,string $aad = ''): boolean|\array{0:
static
Throws
\SodiumException

Arguments

$state

string

$msg

string

$aad

string

Response

boolean|\array{0:

string, 1: int}

crypto_secretstream_xchacha20poly1305_push

crypto_secretstream_xchacha20poly1305_push(string &$state,string $msg,string $aad = '',integer $tag): string
static
Throws
\SodiumException

Arguments

$state

string

$msg

string

$aad

string

$tag

integer

Response

string

crypto_secretstream_xchacha20poly1305_rekey

crypto_secretstream_xchacha20poly1305_rekey(string &$state): void
static
Throws
\SodiumException

Arguments

$state

string

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

crypto_shorthash(string $message,string $key): string
static
psalm-suppress

MixedArgument

MixedInferredReturnType

MixedReturnStatement

Throws
\SodiumException
\TypeError

Arguments

$message

string

Input message

$key

string

SipHash-2-4 key

Response

string

Hash

Return a secure random key for use with crypto_shorthash

crypto_shorthash_keygen(): string
static
Throws
\Exception
\Error

Response

string

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

crypto_sign(string $message,string $secretKey): string
static

Algorithm: Ed25519 (EdDSA over Curve25519)

psalm-suppress

MixedArgument

MixedInferredReturnType

MixedReturnStatement

Throws
\SodiumException
\TypeError

Arguments

$message

string

Message to be signed.

$secretKey

string

Secret signing key.

Response

string

Signed message (signature is prefixed).

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

crypto_sign_detached(string $message,string $secretKey): string
static

Algorithm: Ed25519 (EdDSA over Curve25519)

psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$message

string

Message to be signed

$secretKey

string

Secret signing key

Response

string

Digital signature

Convert an Ed25519 public key to a Curve25519 public key

crypto_sign_ed25519_pk_to_curve25519(string $pk): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$pk

string

Response

string

Convert an Ed25519 secret key to a Curve25519 secret key

crypto_sign_ed25519_sk_to_curve25519(string $sk): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$sk

string

Response

string

Generate a new random Ed25519 keypair.

crypto_sign_keypair(): string
static
Throws
\SodiumException
\TypeError

Response

string

crypto_sign_keypair_from_secretkey_and_publickey

crypto_sign_keypair_from_secretkey_and_publickey(string $sk,string $pk): string
static
Throws
\SodiumException

Arguments

$sk

string

$pk

string

Response

string

Validates a signed message then returns the message.

crypto_sign_open(string $signedMessage,string $publicKey): string
static
psalm-suppress

MixedArgument

MixedInferredReturnType

MixedReturnStatement

Throws
\SodiumException
\TypeError

Arguments

$signedMessage

string

A signed message

$publicKey

string

A public key

Response

string

The original message (if the signature is valid for this public key)

Extract an Ed25519 public key from an Ed25519 keypair.

crypto_sign_publickey(string $keypair): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$keypair

string

Keypair

Response

string

Public key

Calculate an Ed25519 public key from an Ed25519 secret key.

crypto_sign_publickey_from_secretkey(string $secretKey): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$secretKey

string

Your Ed25519 secret key

Response

string

The corresponding Ed25519 public key

Extract an Ed25519 secret key from an Ed25519 keypair.

crypto_sign_secretkey(string $keypair): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$keypair

string

Keypair

Response

string

Secret key

Generate an Ed25519 keypair from a seed.

crypto_sign_seed_keypair(string $seed): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$seed

string

Input seed

Response

string

Keypair

Verify the Ed25519 signature of a message.

crypto_sign_verify_detached(string $signature,string $message,string $publicKey): boolean
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$signature

string

Digital sginature

$message

string

Message to be verified

$publicKey

string

Public key

Response

boolean

TRUE if this signature is good for this public key; FALSE otherwise

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

crypto_stream(integer $len,string $nonce,string $key): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$len

integer

Number of bytes desired

$nonce

string

Number to be used Once; must be 24 bytes

$key

string

XSalsa20 key

Response

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)

Return a secure random key for use with crypto_stream

crypto_stream_keygen(): string
static
Throws
\Exception
\Error

Response

string

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

crypto_stream_xchacha20(integer $len,string $nonce,string $key,boolean $dontFallback = false): string
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$len

integer

Number of bytes desired

$nonce

string

Number to be used Once; must be 24 bytes

$key

string

XChaCha20 key

$dontFallback

boolean

Response

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)

Return a secure random key for use with crypto_stream_xchacha20

crypto_stream_xchacha20_keygen(): string
static
Throws
\Exception
\Error

Response

string

DANGER! UNAUTHENTICATED ENCRYPTION!

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

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

Algorithm: XChaCha20

This DOES NOT provide ciphertext integrity.

psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$message

string

Plaintext message

$nonce

string

Number to be used Once; must be 24 bytes

$key

string

Encryption key

$dontFallback

boolean

Response

string

Encrypted text which is vulnerable to chosen- ciphertext attacks unless you implement some other mitigation to the ciphertext (i.e. Encrypt then MAC)

DANGER! UNAUTHENTICATED ENCRYPTION!

crypto_stream_xchacha20_xor_ic(string $message,string $nonce,integer $counter,string $key,boolean $dontFallback = false): string
static

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

Algorithm: XChaCha20

This DOES NOT provide ciphertext integrity.

psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$message

string

Plaintext message

$nonce

string

Number to be used Once; must be 24 bytes

$counter

integer

$key

string

Encryption key

$dontFallback

boolean

Response

string

Encrypted text which is vulnerable to chosen- ciphertext attacks unless you implement some other mitigation to the ciphertext (i.e. Encrypt then MAC)

DANGER! UNAUTHENTICATED ENCRYPTION!

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

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

Algorithm: XSalsa20

This DOES NOT provide ciphertext integrity.

psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$message

string

Plaintext message

$nonce

string

Number to be used Once; must be 24 bytes

$key

string

Encryption key

Response

string

Encrypted text which is vulnerable to chosen- ciphertext attacks unless you implement some other mitigation to the ciphertext (i.e. Encrypt then MAC)

Cache-timing-safe implementation of hex2bin().

hex2bin(string $string,string $ignore = ''): string
static
psalm-suppress

TooFewArguments

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$string

string

Hexadecimal string

$ignore

string

List of characters to ignore; useful for whitespace

Response

string

Raw binary string

Increase a string (little endian)

increment(string &$var): void
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$var

string

is_zero

is_zero(string $str): boolean
static
Throws
\SodiumException

Arguments

$str

string

Response

boolean

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

library_version_major(): integer
static

Response

integer

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

library_version_minor(): integer
static

Response

integer

Compare two strings.

memcmp(string $left,string $right): integer
static
psalm-suppress

MixedArgument

Throws
\SodiumException
\TypeError

Arguments

$left

string

$right

string

Response

integer

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

memzero(string|null &$var): void
static
param-out

string|null $var

psalm-suppress

TooFewArguments

Throws
\SodiumException

(Unless libsodium is installed)

\TypeError

Arguments

$var

string|null

pad

pad(string $unpadded,integer $blockSize,boolean $dontFallback = false): string
static
Throws
\SodiumException

Arguments

$unpadded

string

$blockSize

integer

$dontFallback

boolean

Response

string

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

polyfill_is_fast(): boolean
static

Response

boolean

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

randombytes_buf(integer $numBytes): string
static

Proudly uses /dev/urandom (if getrandom(2) is not available).

Throws
\Exception
\TypeError

Arguments

$numBytes

integer

Response

string

Generate a random 16-bit integer.

randombytes_random16(): integer
static
Throws
\Exception
\Error
\TypeError

Response

integer

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

randombytes_uniform(integer $range): integer
static
Throws
\Exception
\Error
\TypeError

Arguments

$range

integer

Response

integer

ristretto255_add

ristretto255_add(string $p,string $q,boolean $dontFallback = false): string
static
Throws
\SodiumException

Arguments

$p

string

$q

string

$dontFallback

boolean

Response

string

ristretto255_from_hash

ristretto255_from_hash(string $r,boolean $dontFallback = false): string
static
Throws
\SodiumException

Arguments

$r

string

$dontFallback

boolean

Response

string

ristretto255_is_valid_point

ristretto255_is_valid_point(string $p,boolean $dontFallback = false): boolean
static
Throws
\SodiumException

Arguments

$p

string

$dontFallback

boolean

Response

boolean

ristretto255_random

ristretto255_random(boolean $dontFallback = false): string
static
Throws
\SodiumException

Arguments

$dontFallback

boolean

Response

string

ristretto255_scalar_add

ristretto255_scalar_add(string $x,string $y,boolean $dontFallback = false): string
static
Throws
\SodiumException

Arguments

$x

string

$y

string

$dontFallback

boolean

Response

string

ristretto255_scalar_complement

ristretto255_scalar_complement(string $s,boolean $dontFallback = false): string
static
Throws
\SodiumException

Arguments

$s

string

$dontFallback

boolean

Response

string

ristretto255_scalar_invert

ristretto255_scalar_invert(string $s,boolean $dontFallback = false): string
static
Throws
\SodiumException

Arguments

$s

string

$dontFallback

boolean

Response

string

ristretto255_scalar_mul

ristretto255_scalar_mul(string $x,string $y,boolean $dontFallback = false): string
static
Throws
\SodiumException

Arguments

$x

string

$y

string

$dontFallback

boolean

Response

string

ristretto255_scalar_negate

ristretto255_scalar_negate(string $s,boolean $dontFallback = false): string
static
Throws
\SodiumException

Arguments

$s

string

$dontFallback

boolean

Response

string

ristretto255_scalar_random

ristretto255_scalar_random(boolean $dontFallback = false): string
static
Throws
\SodiumException

Arguments

$dontFallback

boolean

Response

string

ristretto255_scalar_reduce

ristretto255_scalar_reduce(string $s,boolean $dontFallback = false): string
static
Throws
\SodiumException

Arguments

$s

string

$dontFallback

boolean

Response

string

ristretto255_scalar_sub

ristretto255_scalar_sub(string $x,string $y,boolean $dontFallback = false): string
static
Throws
\SodiumException

Arguments

$x

string

$y

string

$dontFallback

boolean

Response

string

ristretto255_sub

ristretto255_sub(string $p,string $q,boolean $dontFallback = false): string
static
Throws
\SodiumException

Arguments

$p

string

$q

string

$dontFallback

boolean

Response

string

Runtime testing method for 32-bit platforms.

runtime_speed_test(integer $iterations,integer $maxTimeout): boolean
static

Usage: If runtime_speed_test() returns FALSE, then our 32-bit implementation is to slow to use safely without risking timeouts. If this happens, install sodium from PECL to get acceptable performance.

Throws
\SodiumException

Arguments

$iterations

integer

Number of multiplications to attempt

$maxTimeout

integer

Milliseconds

Response

boolean

TRUE if we're fast enough, FALSE is not

scalarmult_ristretto255

scalarmult_ristretto255(string $n,string $p,boolean $dontFallback = false): string
static
Throws
\SodiumException

Arguments

$n

string

$p

string

$dontFallback

boolean

Response

string

scalarmult_ristretto255_base

scalarmult_ristretto255_base(string $n,boolean $dontFallback = false): string
static
Throws
\SodiumException

Arguments

$n

string

$dontFallback

boolean

Response

string

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

sub(string &$val,string $addv): void
static

This mutates $val.

Throws
\SodiumException

Arguments

$val

string

$addv

string

unpad

unpad(string $padded,integer $blockSize,boolean $dontFallback = false): string
static
Throws
\SodiumException

Arguments

$padded

string

$blockSize

integer

$dontFallback

boolean

Response

string

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.)

use_fallback(string $sodium_func_name = ''): boolean
static

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

Arguments

$sodium_func_name

string

Response

boolean

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

useNewSodiumAPI(): boolean
static
ref

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

Response

boolean

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

version_string(): string
static
psalm-suppress

MixedInferredReturnType

UndefinedFunction

Response

string

Constants

LIBRARY_MAJOR_VERSION

LIBRARY_MAJOR_VERSION

LIBRARY_MINOR_VERSION

LIBRARY_MINOR_VERSION

LIBRARY_VERSION_MAJOR

LIBRARY_VERSION_MAJOR

LIBRARY_VERSION_MINOR

LIBRARY_VERSION_MINOR

VERSION_STRING

VERSION_STRING

BASE64_VARIANT_ORIGINAL

BASE64_VARIANT_ORIGINAL

BASE64_VARIANT_ORIGINAL_NO_PADDING

BASE64_VARIANT_ORIGINAL_NO_PADDING

BASE64_VARIANT_URLSAFE

BASE64_VARIANT_URLSAFE

BASE64_VARIANT_URLSAFE_NO_PADDING

BASE64_VARIANT_URLSAFE_NO_PADDING

CRYPTO_AEAD_AES256GCM_KEYBYTES

CRYPTO_AEAD_AES256GCM_KEYBYTES

CRYPTO_AEAD_AES256GCM_NSECBYTES

CRYPTO_AEAD_AES256GCM_NSECBYTES

CRYPTO_AEAD_AES256GCM_NPUBBYTES

CRYPTO_AEAD_AES256GCM_NPUBBYTES

CRYPTO_AEAD_AES256GCM_ABYTES

CRYPTO_AEAD_AES256GCM_ABYTES

CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES

CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES

CRYPTO_AEAD_CHACHA20POLY1305_NSECBYTES

CRYPTO_AEAD_CHACHA20POLY1305_NSECBYTES

CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES

CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES

CRYPTO_AEAD_CHACHA20POLY1305_ABYTES

CRYPTO_AEAD_CHACHA20POLY1305_ABYTES

CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES

CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES

CRYPTO_AEAD_CHACHA20POLY1305_IETF_NSECBYTES

CRYPTO_AEAD_CHACHA20POLY1305_IETF_NSECBYTES

CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES

CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES

CRYPTO_AEAD_CHACHA20POLY1305_IETF_ABYTES

CRYPTO_AEAD_CHACHA20POLY1305_IETF_ABYTES

CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES

CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES

CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NSECBYTES

CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NSECBYTES

CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES

CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES

CRYPTO_AEAD_XCHACHA20POLY1305_IETF_ABYTES

CRYPTO_AEAD_XCHACHA20POLY1305_IETF_ABYTES

CRYPTO_AUTH_BYTES

CRYPTO_AUTH_BYTES

CRYPTO_AUTH_KEYBYTES

CRYPTO_AUTH_KEYBYTES

CRYPTO_BOX_SEALBYTES

CRYPTO_BOX_SEALBYTES

CRYPTO_BOX_SECRETKEYBYTES

CRYPTO_BOX_SECRETKEYBYTES

CRYPTO_BOX_PUBLICKEYBYTES

CRYPTO_BOX_PUBLICKEYBYTES

CRYPTO_BOX_KEYPAIRBYTES

CRYPTO_BOX_KEYPAIRBYTES

CRYPTO_BOX_MACBYTES

CRYPTO_BOX_MACBYTES

CRYPTO_BOX_NONCEBYTES

CRYPTO_BOX_NONCEBYTES

CRYPTO_BOX_SEEDBYTES

CRYPTO_BOX_SEEDBYTES

CRYPTO_CORE_RISTRETTO255_BYTES

CRYPTO_CORE_RISTRETTO255_BYTES

CRYPTO_CORE_RISTRETTO255_SCALARBYTES

CRYPTO_CORE_RISTRETTO255_SCALARBYTES

CRYPTO_CORE_RISTRETTO255_HASHBYTES

CRYPTO_CORE_RISTRETTO255_HASHBYTES

CRYPTO_CORE_RISTRETTO255_NONREDUCEDSCALARBYTES

CRYPTO_CORE_RISTRETTO255_NONREDUCEDSCALARBYTES

CRYPTO_KDF_BYTES_MIN

CRYPTO_KDF_BYTES_MIN

CRYPTO_KDF_BYTES_MAX

CRYPTO_KDF_BYTES_MAX

CRYPTO_KDF_CONTEXTBYTES

CRYPTO_KDF_CONTEXTBYTES

CRYPTO_KDF_KEYBYTES

CRYPTO_KDF_KEYBYTES

CRYPTO_KX_BYTES

CRYPTO_KX_BYTES

CRYPTO_KX_PRIMITIVE

CRYPTO_KX_PRIMITIVE

CRYPTO_KX_SEEDBYTES

CRYPTO_KX_SEEDBYTES

CRYPTO_KX_KEYPAIRBYTES

CRYPTO_KX_KEYPAIRBYTES

CRYPTO_KX_PUBLICKEYBYTES

CRYPTO_KX_PUBLICKEYBYTES

CRYPTO_KX_SECRETKEYBYTES

CRYPTO_KX_SECRETKEYBYTES

CRYPTO_KX_SESSIONKEYBYTES

CRYPTO_KX_SESSIONKEYBYTES

CRYPTO_GENERICHASH_BYTES

CRYPTO_GENERICHASH_BYTES

CRYPTO_GENERICHASH_BYTES_MIN

CRYPTO_GENERICHASH_BYTES_MIN

CRYPTO_GENERICHASH_BYTES_MAX

CRYPTO_GENERICHASH_BYTES_MAX

CRYPTO_GENERICHASH_KEYBYTES

CRYPTO_GENERICHASH_KEYBYTES

CRYPTO_GENERICHASH_KEYBYTES_MIN

CRYPTO_GENERICHASH_KEYBYTES_MIN

CRYPTO_GENERICHASH_KEYBYTES_MAX

CRYPTO_GENERICHASH_KEYBYTES_MAX

CRYPTO_PWHASH_SALTBYTES

CRYPTO_PWHASH_SALTBYTES

CRYPTO_PWHASH_STRPREFIX

CRYPTO_PWHASH_STRPREFIX

CRYPTO_PWHASH_ALG_ARGON2I13

CRYPTO_PWHASH_ALG_ARGON2I13

CRYPTO_PWHASH_ALG_ARGON2ID13

CRYPTO_PWHASH_ALG_ARGON2ID13

CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE

CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE

CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE

CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE

CRYPTO_PWHASH_MEMLIMIT_MODERATE

CRYPTO_PWHASH_MEMLIMIT_MODERATE

CRYPTO_PWHASH_OPSLIMIT_MODERATE

CRYPTO_PWHASH_OPSLIMIT_MODERATE

CRYPTO_PWHASH_MEMLIMIT_SENSITIVE

CRYPTO_PWHASH_MEMLIMIT_SENSITIVE

CRYPTO_PWHASH_OPSLIMIT_SENSITIVE

CRYPTO_PWHASH_OPSLIMIT_SENSITIVE

CRYPTO_PWHASH_SCRYPTSALSA208SHA256_SALTBYTES

CRYPTO_PWHASH_SCRYPTSALSA208SHA256_SALTBYTES

CRYPTO_PWHASH_SCRYPTSALSA208SHA256_STRPREFIX

CRYPTO_PWHASH_SCRYPTSALSA208SHA256_STRPREFIX

CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_INTERACTIVE

CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_INTERACTIVE

CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE

CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE

CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_SENSITIVE

CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_SENSITIVE

CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_SENSITIVE

CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_SENSITIVE

CRYPTO_SCALARMULT_BYTES

CRYPTO_SCALARMULT_BYTES

CRYPTO_SCALARMULT_SCALARBYTES

CRYPTO_SCALARMULT_SCALARBYTES

CRYPTO_SCALARMULT_RISTRETTO255_BYTES

CRYPTO_SCALARMULT_RISTRETTO255_BYTES

CRYPTO_SCALARMULT_RISTRETTO255_SCALARBYTES

CRYPTO_SCALARMULT_RISTRETTO255_SCALARBYTES

CRYPTO_SHORTHASH_BYTES

CRYPTO_SHORTHASH_BYTES

CRYPTO_SHORTHASH_KEYBYTES

CRYPTO_SHORTHASH_KEYBYTES

CRYPTO_SECRETBOX_KEYBYTES

CRYPTO_SECRETBOX_KEYBYTES

CRYPTO_SECRETBOX_MACBYTES

CRYPTO_SECRETBOX_MACBYTES

CRYPTO_SECRETBOX_NONCEBYTES

CRYPTO_SECRETBOX_NONCEBYTES

CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_ABYTES

CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_ABYTES

CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES

CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES

CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES

CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES

CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PUSH

CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PUSH

CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PULL

CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PULL

CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_REKEY

CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_REKEY

CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_FINAL

CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_FINAL

CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_MESSAGEBYTES_MAX

CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_MESSAGEBYTES_MAX

CRYPTO_SIGN_BYTES

CRYPTO_SIGN_BYTES

CRYPTO_SIGN_SEEDBYTES

CRYPTO_SIGN_SEEDBYTES

CRYPTO_SIGN_PUBLICKEYBYTES

CRYPTO_SIGN_PUBLICKEYBYTES

CRYPTO_SIGN_SECRETKEYBYTES

CRYPTO_SIGN_SECRETKEYBYTES

CRYPTO_SIGN_KEYPAIRBYTES

CRYPTO_SIGN_KEYPAIRBYTES

CRYPTO_STREAM_KEYBYTES

CRYPTO_STREAM_KEYBYTES

CRYPTO_STREAM_NONCEBYTES

CRYPTO_STREAM_NONCEBYTES

CRYPTO_STREAM_XCHACHA20_KEYBYTES

CRYPTO_STREAM_XCHACHA20_KEYBYTES

CRYPTO_STREAM_XCHACHA20_NONCEBYTES

CRYPTO_STREAM_XCHACHA20_NONCEBYTES

Properties

This parameter prevents the use of the PECL extension.

disableFallbackForUnitTests :boolean
static

It should only be used for unit testing.

var

Type(s)

boolean

Use fast multiplication rather than our constant-time multiplication implementation. Can be enabled at runtime. Only enable this if you are absolutely certain that there is no timing leak on your platform.

fastMult :boolean
static
var

Type(s)

boolean