<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.sodium.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'ref.sodium.php',
    1 => 'Sodium Functions',
    2 => 'Sodium Functions',
  ),
  'up' => 
  array (
    0 => 'book.sodium.php',
    1 => 'Sodium',
  ),
  'prev' => 
  array (
    0 => 'sodium.constants.php',
    1 => 'Predefined Constants',
  ),
  'next' => 
  array (
    0 => 'function.sodium-add.php',
    1 => 'sodium_add',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/sodium/reference.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/ref.sodium.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="ref.sodium" class="reference">
 <h1 class="title">Sodium Functions</h1>

 





















































































































































































































































































































































































































































































































































<h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="function.sodium-add.php">sodium_add</a> — Add large numbers</li><li><a href="function.sodium-base642bin.php">sodium_base642bin</a> — Decodes a base64-encoded string into raw binary.</li><li><a href="function.sodium-bin2base64.php">sodium_bin2base64</a> — Encodes a raw binary string with base64.</li><li><a href="function.sodium-bin2hex.php">sodium_bin2hex</a> — Encode to hexadecimal</li><li><a href="function.sodium-compare.php">sodium_compare</a> — Compare large numbers</li><li><a href="function.sodium-crypto-aead-aegis128l-decrypt.php">sodium_crypto_aead_aegis128l_decrypt</a> — Verify then decrypt a message with AEGIS-128L</li><li><a href="function.sodium-crypto-aead-aegis128l-encrypt.php">sodium_crypto_aead_aegis128l_encrypt</a> — Encrypt then authenticate a message with AEGIS-128L</li><li><a href="function.sodium-crypto-aead-aegis128l-keygen.php">sodium_crypto_aead_aegis128l_keygen</a> — Generate a random AEGIS-128L key</li><li><a href="function.sodium-crypto-aead-aegis256-decrypt.php">sodium_crypto_aead_aegis256_decrypt</a> — Verify then decrypt a message with AEGIS-256</li><li><a href="function.sodium-crypto-aead-aegis256-encrypt.php">sodium_crypto_aead_aegis256_encrypt</a> — Encrypt then authenticate a message with AEGIS-256</li><li><a href="function.sodium-crypto-aead-aegis256-keygen.php">sodium_crypto_aead_aegis256_keygen</a> — Generate a random AEGIS-256 key</li><li><a href="function.sodium-crypto-aead-aes256gcm-decrypt.php">sodium_crypto_aead_aes256gcm_decrypt</a> — Verify then decrypt a message with AES-256-GCM</li><li><a href="function.sodium-crypto-aead-aes256gcm-encrypt.php">sodium_crypto_aead_aes256gcm_encrypt</a> — Encrypt then authenticate with AES-256-GCM</li><li><a href="function.sodium-crypto-aead-aes256gcm-is-available.php">sodium_crypto_aead_aes256gcm_is_available</a> — Check if hardware supports AES256-GCM</li><li><a href="function.sodium-crypto-aead-aes256gcm-keygen.php">sodium_crypto_aead_aes256gcm_keygen</a> — Generate a random AES-256-GCM key</li><li><a href="function.sodium-crypto-aead-chacha20poly1305-decrypt.php">sodium_crypto_aead_chacha20poly1305_decrypt</a> — Verify then decrypt with ChaCha20-Poly1305</li><li><a href="function.sodium-crypto-aead-chacha20poly1305-encrypt.php">sodium_crypto_aead_chacha20poly1305_encrypt</a> — Encrypt then authenticate with ChaCha20-Poly1305</li><li><a href="function.sodium-crypto-aead-chacha20poly1305-ietf-decrypt.php">sodium_crypto_aead_chacha20poly1305_ietf_decrypt</a> — Verify that the ciphertext includes a valid tag</li><li><a href="function.sodium-crypto-aead-chacha20poly1305-ietf-encrypt.php">sodium_crypto_aead_chacha20poly1305_ietf_encrypt</a> — Encrypt a message</li><li><a href="function.sodium-crypto-aead-chacha20poly1305-ietf-keygen.php">sodium_crypto_aead_chacha20poly1305_ietf_keygen</a> — Generate a random ChaCha20-Poly1305 (IETF) key.</li><li><a href="function.sodium-crypto-aead-chacha20poly1305-keygen.php">sodium_crypto_aead_chacha20poly1305_keygen</a> — Generate a random ChaCha20-Poly1305 key.</li><li><a href="function.sodium-crypto-aead-xchacha20poly1305-ietf-decrypt.php">sodium_crypto_aead_xchacha20poly1305_ietf_decrypt</a> — (Preferred) Verify then decrypt with XChaCha20-Poly1305</li><li><a href="function.sodium-crypto-aead-xchacha20poly1305-ietf-encrypt.php">sodium_crypto_aead_xchacha20poly1305_ietf_encrypt</a> — (Preferred) Encrypt then authenticate with XChaCha20-Poly1305</li><li><a href="function.sodium-crypto-aead-xchacha20poly1305-ietf-keygen.php">sodium_crypto_aead_xchacha20poly1305_ietf_keygen</a> — Generate a random XChaCha20-Poly1305 key.</li><li><a href="function.sodium-crypto-auth.php">sodium_crypto_auth</a> — Compute a tag for the message</li><li><a href="function.sodium-crypto-auth-keygen.php">sodium_crypto_auth_keygen</a> — Generate a random key for sodium_crypto_auth</li><li><a href="function.sodium-crypto-auth-verify.php">sodium_crypto_auth_verify</a> — Verifies that the tag is valid for the message</li><li><a href="function.sodium-crypto-box.php">sodium_crypto_box</a> — Authenticated public-key encryption</li><li><a href="function.sodium-crypto-box-keypair.php">sodium_crypto_box_keypair</a> — Randomly generate a secret key and a corresponding public key</li><li><a href="function.sodium-crypto-box-keypair-from-secretkey-and-publickey.php">sodium_crypto_box_keypair_from_secretkey_and_publickey</a> — Create a unified keypair string from a secret key and public key</li><li><a href="function.sodium-crypto-box-open.php">sodium_crypto_box_open</a> — Authenticated public-key decryption</li><li><a href="function.sodium-crypto-box-publickey.php">sodium_crypto_box_publickey</a> — Extract the public key from a crypto_box keypair</li><li><a href="function.sodium-crypto-box-publickey-from-secretkey.php">sodium_crypto_box_publickey_from_secretkey</a> — Calculate the public key from a secret key</li><li><a href="function.sodium-crypto-box-seal.php">sodium_crypto_box_seal</a> — Anonymous public-key encryption</li><li><a href="function.sodium-crypto-box-seal-open.php">sodium_crypto_box_seal_open</a> — Anonymous public-key decryption</li><li><a href="function.sodium-crypto-box-secretkey.php">sodium_crypto_box_secretkey</a> — Extracts the secret key from a crypto_box keypair</li><li><a href="function.sodium-crypto-box-seed-keypair.php">sodium_crypto_box_seed_keypair</a> — Deterministically derive the key pair from a single key</li><li><a href="function.sodium-crypto-core-ristretto255-add.php">sodium_crypto_core_ristretto255_add</a> — Adds an element</li><li><a href="function.sodium-crypto-core-ristretto255-from-hash.php">sodium_crypto_core_ristretto255_from_hash</a> — Maps a vector</li><li><a href="function.sodium-crypto-core-ristretto255-is-valid-point.php">sodium_crypto_core_ristretto255_is_valid_point</a> — Determines if a point on the ristretto255 curve</li><li><a href="function.sodium-crypto-core-ristretto255-random.php">sodium_crypto_core_ristretto255_random</a> — Generates a random key</li><li><a href="function.sodium-crypto-core-ristretto255-scalar-add.php">sodium_crypto_core_ristretto255_scalar_add</a> — Adds a scalar value</li><li><a href="function.sodium-crypto-core-ristretto255-scalar-complement.php">sodium_crypto_core_ristretto255_scalar_complement</a> — The sodium_crypto_core_ristretto255_scalar_complement purpose</li><li><a href="function.sodium-crypto-core-ristretto255-scalar-invert.php">sodium_crypto_core_ristretto255_scalar_invert</a> — Inverts a scalar value</li><li><a href="function.sodium-crypto-core-ristretto255-scalar-mul.php">sodium_crypto_core_ristretto255_scalar_mul</a> — Multiplies a scalar value</li><li><a href="function.sodium-crypto-core-ristretto255-scalar-negate.php">sodium_crypto_core_ristretto255_scalar_negate</a> — Negates a scalar value</li><li><a href="function.sodium-crypto-core-ristretto255-scalar-random.php">sodium_crypto_core_ristretto255_scalar_random</a> — Generates a random key</li><li><a href="function.sodium-crypto-core-ristretto255-scalar-reduce.php">sodium_crypto_core_ristretto255_scalar_reduce</a> — Reduces a scalar value</li><li><a href="function.sodium-crypto-core-ristretto255-scalar-sub.php">sodium_crypto_core_ristretto255_scalar_sub</a> — Subtracts a scalar value</li><li><a href="function.sodium-crypto-core-ristretto255-sub.php">sodium_crypto_core_ristretto255_sub</a> — Subtracts an element</li><li><a href="function.sodium-crypto-generichash.php">sodium_crypto_generichash</a> — Get a hash of the message</li><li><a href="function.sodium-crypto-generichash-final.php">sodium_crypto_generichash_final</a> — Complete the hash</li><li><a href="function.sodium-crypto-generichash-init.php">sodium_crypto_generichash_init</a> — Initialize a hash for streaming</li><li><a href="function.sodium-crypto-generichash-keygen.php">sodium_crypto_generichash_keygen</a> — Generate a random generichash key</li><li><a href="function.sodium-crypto-generichash-update.php">sodium_crypto_generichash_update</a> — Add message to a hash</li><li><a href="function.sodium-crypto-kdf-derive-from-key.php">sodium_crypto_kdf_derive_from_key</a> — Derive a subkey</li><li><a href="function.sodium-crypto-kdf-keygen.php">sodium_crypto_kdf_keygen</a> — Generate a random root key for the KDF interface</li><li><a href="function.sodium-crypto-kx-client-session-keys.php">sodium_crypto_kx_client_session_keys</a> — Calculate the client-side session keys.</li><li><a href="function.sodium-crypto-kx-keypair.php">sodium_crypto_kx_keypair</a> — Creates a new sodium keypair</li><li><a href="function.sodium-crypto-kx-publickey.php">sodium_crypto_kx_publickey</a> — Extract the public key from a crypto_kx keypair</li><li><a href="function.sodium-crypto-kx-secretkey.php">sodium_crypto_kx_secretkey</a> — Extract the secret key from a crypto_kx keypair.</li><li><a href="function.sodium-crypto-kx-seed-keypair.php">sodium_crypto_kx_seed_keypair</a> — Description</li><li><a href="function.sodium-crypto-kx-server-session-keys.php">sodium_crypto_kx_server_session_keys</a> — Calculate the server-side session keys.</li><li><a href="function.sodium-crypto-pwhash.php">sodium_crypto_pwhash</a> — Derive a key from a password, using Argon2</li><li><a href="function.sodium-crypto-pwhash-scryptsalsa208sha256.php">sodium_crypto_pwhash_scryptsalsa208sha256</a> — Derives a key from a password, using scrypt</li><li><a href="function.sodium-crypto-pwhash-scryptsalsa208sha256-str.php">sodium_crypto_pwhash_scryptsalsa208sha256_str</a> — Get an ASCII encoded hash</li><li><a href="function.sodium-crypto-pwhash-scryptsalsa208sha256-str-verify.php">sodium_crypto_pwhash_scryptsalsa208sha256_str_verify</a> — Verify that the password is a valid password verification string</li><li><a href="function.sodium-crypto-pwhash-str.php">sodium_crypto_pwhash_str</a> — Get an ASCII-encoded hash</li><li><a href="function.sodium-crypto-pwhash-str-needs-rehash.php">sodium_crypto_pwhash_str_needs_rehash</a> — Determine whether or not to rehash a password</li><li><a href="function.sodium-crypto-pwhash-str-verify.php">sodium_crypto_pwhash_str_verify</a> — Verifies that a password matches a hash</li><li><a href="function.sodium-crypto-scalarmult.php">sodium_crypto_scalarmult</a> — Compute a shared secret given a user's secret key and another user's public key</li><li><a href="function.sodium-crypto-scalarmult-base.php">sodium_crypto_scalarmult_base</a> — Alias of sodium_crypto_box_publickey_from_secretkey</li><li><a href="function.sodium-crypto-scalarmult-ristretto255.php">sodium_crypto_scalarmult_ristretto255</a> — Computes a shared secret</li><li><a href="function.sodium-crypto-scalarmult-ristretto255-base.php">sodium_crypto_scalarmult_ristretto255_base</a> — Calculates the public key from a secret key</li><li><a href="function.sodium-crypto-secretbox.php">sodium_crypto_secretbox</a> — Authenticated shared-key encryption</li><li><a href="function.sodium-crypto-secretbox-keygen.php">sodium_crypto_secretbox_keygen</a> — Generate random key for sodium_crypto_secretbox</li><li><a href="function.sodium-crypto-secretbox-open.php">sodium_crypto_secretbox_open</a> — Authenticated shared-key decryption</li><li><a href="function.sodium-crypto-secretstream-xchacha20poly1305-init-pull.php">sodium_crypto_secretstream_xchacha20poly1305_init_pull</a> — Initialize a secretstream context for decryption</li><li><a href="function.sodium-crypto-secretstream-xchacha20poly1305-init-push.php">sodium_crypto_secretstream_xchacha20poly1305_init_push</a> — Initialize a secretstream context for encryption</li><li><a href="function.sodium-crypto-secretstream-xchacha20poly1305-keygen.php">sodium_crypto_secretstream_xchacha20poly1305_keygen</a> — Generate a random secretstream key.</li><li><a href="function.sodium-crypto-secretstream-xchacha20poly1305-pull.php">sodium_crypto_secretstream_xchacha20poly1305_pull</a> — Decrypt a chunk of data from an encrypted stream</li><li><a href="function.sodium-crypto-secretstream-xchacha20poly1305-push.php">sodium_crypto_secretstream_xchacha20poly1305_push</a> — Encrypt a chunk of data so that it can safely be decrypted in a streaming API</li><li><a href="function.sodium-crypto-secretstream-xchacha20poly1305-rekey.php">sodium_crypto_secretstream_xchacha20poly1305_rekey</a> — Explicitly rotate the key in the secretstream state</li><li><a href="function.sodium-crypto-shorthash.php">sodium_crypto_shorthash</a> — Compute a short hash of a message and key</li><li><a href="function.sodium-crypto-shorthash-keygen.php">sodium_crypto_shorthash_keygen</a> — Get random bytes for key</li><li><a href="function.sodium-crypto-sign.php">sodium_crypto_sign</a> — Sign a message</li><li><a href="function.sodium-crypto-sign-detached.php">sodium_crypto_sign_detached</a> — Sign the message</li><li><a href="function.sodium-crypto-sign-ed25519-pk-to-curve25519.php">sodium_crypto_sign_ed25519_pk_to_curve25519</a> — Convert an Ed25519 public key to a Curve25519 public key</li><li><a href="function.sodium-crypto-sign-ed25519-sk-to-curve25519.php">sodium_crypto_sign_ed25519_sk_to_curve25519</a> — Convert an Ed25519 secret key to a Curve25519 secret key</li><li><a href="function.sodium-crypto-sign-keypair.php">sodium_crypto_sign_keypair</a> — Randomly generate a secret key and a corresponding public key</li><li><a href="function.sodium-crypto-sign-keypair-from-secretkey-and-publickey.php">sodium_crypto_sign_keypair_from_secretkey_and_publickey</a> — Join a secret key and public key together</li><li><a href="function.sodium-crypto-sign-open.php">sodium_crypto_sign_open</a> — Check that the signed message has a valid signature</li><li><a href="function.sodium-crypto-sign-publickey.php">sodium_crypto_sign_publickey</a> — Extract the Ed25519 public key from a keypair</li><li><a href="function.sodium-crypto-sign-publickey-from-secretkey.php">sodium_crypto_sign_publickey_from_secretkey</a> — Extract the Ed25519 public key from the secret key</li><li><a href="function.sodium-crypto-sign-secretkey.php">sodium_crypto_sign_secretkey</a> — Extract the Ed25519 secret key from a keypair</li><li><a href="function.sodium-crypto-sign-seed-keypair.php">sodium_crypto_sign_seed_keypair</a> — Deterministically derive the key pair from a single key</li><li><a href="function.sodium-crypto-sign-verify-detached.php">sodium_crypto_sign_verify_detached</a> — Verify signature for the message</li><li><a href="function.sodium-crypto-stream.php">sodium_crypto_stream</a> — Generate a deterministic sequence of bytes from a seed</li><li><a href="function.sodium-crypto-stream-keygen.php">sodium_crypto_stream_keygen</a> — Generate a random sodium_crypto_stream key.</li><li><a href="function.sodium-crypto-stream-xchacha20.php">sodium_crypto_stream_xchacha20</a> — Expands the key and nonce into a keystream of pseudorandom bytes</li><li><a href="function.sodium-crypto-stream-xchacha20-keygen.php">sodium_crypto_stream_xchacha20_keygen</a> — Returns a secure random key</li><li><a href="function.sodium-crypto-stream-xchacha20-xor.php">sodium_crypto_stream_xchacha20_xor</a> — Encrypts a message using a nonce and a secret key (no authentication)</li><li><a href="function.sodium-crypto-stream-xchacha20-xor-ic.php">sodium_crypto_stream_xchacha20_xor_ic</a> — Encrypts a message using a nonce and a secret key (no authentication)</li><li><a href="function.sodium-crypto-stream-xor.php">sodium_crypto_stream_xor</a> — Encrypt a message without authentication</li><li><a href="function.sodium-hex2bin.php">sodium_hex2bin</a> — Decodes a hexadecimally encoded binary string</li><li><a href="function.sodium-increment.php">sodium_increment</a> — Increment large number</li><li><a href="function.sodium-memcmp.php">sodium_memcmp</a> — Test for equality in constant-time</li><li><a href="function.sodium-memzero.php">sodium_memzero</a> — Overwrite a string with NUL characters</li><li><a href="function.sodium-pad.php">sodium_pad</a> — Add padding data</li><li><a href="function.sodium-unpad.php">sodium_unpad</a> — Remove padding data</li></ul>
</div>
<?php manual_footer($setup); ?>