[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
Libsodium compatibility layer
File Size: | 4515 lines (164 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
ParagonIE_Sodium_Compat:: (128 methods):
add()
base642bin()
bin2base64()
bin2hex()
compare()
crypto_aead_aegis128l_decrypt()
crypto_aead_aegis128l_encrypt()
crypto_aead_aegis128l_keygen()
crypto_aead_aegis256_decrypt()
crypto_aead_aegis256_encrypt()
crypto_aead_aegis256_keygen()
crypto_aead_aes256gcm_is_available()
crypto_aead_aes256gcm_decrypt()
crypto_aead_aes256gcm_encrypt()
crypto_aead_aes256gcm_keygen()
crypto_aead_chacha20poly1305_decrypt()
crypto_aead_chacha20poly1305_encrypt()
crypto_aead_chacha20poly1305_ietf_decrypt()
crypto_aead_chacha20poly1305_keygen()
crypto_aead_chacha20poly1305_ietf_encrypt()
crypto_aead_chacha20poly1305_ietf_keygen()
crypto_aead_xchacha20poly1305_ietf_decrypt()
crypto_aead_xchacha20poly1305_ietf_encrypt()
crypto_aead_xchacha20poly1305_ietf_keygen()
crypto_auth()
crypto_auth_keygen()
crypto_auth_verify()
crypto_box()
crypto_box_seal()
crypto_box_seal_open()
crypto_box_keypair()
crypto_box_keypair_from_secretkey_and_publickey()
crypto_box_open()
crypto_box_publickey()
crypto_box_publickey_from_secretkey()
crypto_box_secretkey()
crypto_box_seed_keypair()
crypto_generichash()
crypto_generichash_final()
crypto_generichash_init()
crypto_generichash_init_salt_personal()
crypto_generichash_update()
crypto_generichash_keygen()
crypto_kdf_derive_from_key()
crypto_kdf_keygen()
crypto_kx()
crypto_kx_seed_keypair()
crypto_kx_keypair()
crypto_kx_client_session_keys()
crypto_kx_server_session_keys()
crypto_kx_secretkey()
crypto_kx_publickey()
crypto_pwhash()
crypto_pwhash_is_available()
crypto_pwhash_str()
crypto_pwhash_str_needs_rehash()
crypto_pwhash_str_verify()
crypto_pwhash_scryptsalsa208sha256()
crypto_pwhash_scryptsalsa208sha256_is_available()
crypto_pwhash_scryptsalsa208sha256_str()
crypto_pwhash_scryptsalsa208sha256_str_verify()
crypto_scalarmult()
crypto_scalarmult_base()
crypto_secretbox()
crypto_secretbox_open()
crypto_secretbox_keygen()
crypto_secretbox_xchacha20poly1305()
crypto_secretbox_xchacha20poly1305_open()
crypto_secretstream_xchacha20poly1305_init_push()
crypto_secretstream_xchacha20poly1305_init_pull()
crypto_secretstream_xchacha20poly1305_push()
crypto_secretstream_xchacha20poly1305_pull()
crypto_secretstream_xchacha20poly1305_keygen()
crypto_secretstream_xchacha20poly1305_rekey()
crypto_shorthash()
crypto_shorthash_keygen()
crypto_sign()
crypto_sign_open()
crypto_sign_keypair()
crypto_sign_keypair_from_secretkey_and_publickey()
crypto_sign_seed_keypair()
crypto_sign_publickey()
crypto_sign_publickey_from_secretkey()
crypto_sign_secretkey()
crypto_sign_detached()
crypto_sign_verify_detached()
crypto_sign_ed25519_pk_to_curve25519()
crypto_sign_ed25519_sk_to_curve25519()
crypto_stream()
crypto_stream_xor()
crypto_stream_keygen()
crypto_stream_xchacha20()
crypto_stream_xchacha20_xor()
crypto_stream_xchacha20_xor_ic()
crypto_stream_xchacha20_keygen()
hex2bin()
increment()
is_zero()
library_version_major()
library_version_minor()
memcmp()
memzero()
pad()
unpad()
polyfill_is_fast()
randombytes_buf()
randombytes_uniform()
randombytes_random16()
ristretto255_is_valid_point()
ristretto255_add()
ristretto255_sub()
ristretto255_from_hash()
ristretto255_random()
ristretto255_scalar_random()
ristretto255_scalar_invert()
ristretto255_scalar_negate()
ristretto255_scalar_complement()
ristretto255_scalar_add()
ristretto255_scalar_sub()
ristretto255_scalar_mul()
scalarmult_ristretto255()
scalarmult_ristretto255_base()
ristretto255_scalar_reduce()
runtime_speed_test()
sub()
version_string()
use_fallback()
useNewSodiumAPI()
Class: ParagonIE_Sodium_Compat - X-Ref
add(&$val,$addv) X-Ref |
Add two numbers (little-endian unsigned), storing the value in the first parameter. This mutates $val. param: string $val param: string $addv return: void |
base642bin($encoded,$variant,$ignore = '') X-Ref |
param: string $encoded param: int $variant param: string $ignore return: string |
bin2base64($decoded,$variant) X-Ref |
param: string $decoded param: int $variant return: string |
bin2hex($string) X-Ref |
Cache-timing-safe implementation of bin2hex(). param: string $string A string (probably raw binary) return: string A hexadecimal-encoded string |
compare($left,$right) X-Ref |
Compare two strings, in constant-time. Compared to memcmp(), compare() is more useful for sorting. param: string $left The left operand; must be a string param: string $right The right operand; must be a string return: int If < 0 if the left operand is less than the right |
crypto_aead_aegis128l_decrypt($ciphertext = '',$assocData = '',$nonce = '',$key = '') X-Ref |
Authenticated Encryption with Associated Data: Decryption Algorithm: AEGIS-128L param: string $ciphertext Encrypted message (with MAC appended) param: string $assocData Authenticated Associated Data (unencrypted) param: string $nonce Number to be used only Once; must be 32 bytes param: string $key Encryption key return: string The original plaintext message |
crypto_aead_aegis128l_encrypt($plaintext = '',$assocData = '',$nonce = '',$key = '') X-Ref |
Authenticated Encryption with Associated Data: Encryption Algorithm: AEGIS-128L param: string $plaintext Message to be encrypted param: string $assocData Authenticated Associated Data (unencrypted) param: string $nonce Number to be used only Once; must be 32 bytes param: string $key Encryption key return: string Ciphertext with 32-byte authentication tag appended |
crypto_aead_aegis128l_keygen() X-Ref |
Return a secure random key for use with the AEGIS-128L symmetric AEAD interface. return: string |
crypto_aead_aegis256_decrypt($ciphertext = '',$assocData = '',$nonce = '',$key = '') X-Ref |
Authenticated Encryption with Associated Data: Decryption Algorithm: AEGIS-256 param: string $ciphertext Encrypted message (with MAC appended) param: string $assocData Authenticated Associated Data (unencrypted) param: string $nonce Number to be used only Once; must be 32 bytes param: string $key Encryption key return: string The original plaintext message |
crypto_aead_aegis256_encrypt($plaintext = '',$assocData = '',$nonce = '',$key = '') X-Ref |
Authenticated Encryption with Associated Data: Encryption Algorithm: AEGIS-256 param: string $plaintext Message to be encrypted param: string $assocData Authenticated Associated Data (unencrypted) param: string $nonce Number to be used only Once; must be 32 bytes param: string $key Encryption key return: string Ciphertext with 32-byte authentication tag appended |
crypto_aead_aegis256_keygen() X-Ref |
Return a secure random key for use with the AEGIS-256 symmetric AEAD interface. return: string |
crypto_aead_aes256gcm_is_available() X-Ref |
Is AES-256-GCM even available to use? return: bool |
crypto_aead_aes256gcm_decrypt($ciphertext = '',$assocData = '',$nonce = '',$key = '') X-Ref |
Authenticated Encryption with Associated Data: Decryption 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. param: string $ciphertext Encrypted message (with Poly1305 MAC appended) param: string $assocData Authenticated Associated Data (unencrypted) param: string $nonce Number to be used only Once; must be 8 bytes param: string $key Encryption key return: string|bool The original plaintext message |
crypto_aead_aes256gcm_encrypt($plaintext = '',$assocData = '',$nonce = '',$key = '') X-Ref |
Authenticated Encryption with Associated Data: Encryption Algorithm: AES-256-GCM param: string $plaintext Message to be encrypted param: string $assocData Authenticated Associated Data (unencrypted) param: string $nonce Number to be used only Once; must be 8 bytes param: string $key Encryption key return: string Ciphertext with a 16-byte GCM message |
crypto_aead_aes256gcm_keygen() X-Ref |
Return a secure random key for use with the AES-256-GCM symmetric AEAD interface. return: string |
crypto_aead_chacha20poly1305_decrypt($ciphertext = '',$assocData = '',$nonce = '',$key = '') X-Ref |
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: string $ciphertext Encrypted message (with Poly1305 MAC appended) param: string $assocData Authenticated Associated Data (unencrypted) param: string $nonce Number to be used only Once; must be 8 bytes param: string $key Encryption key return: string The original plaintext message |
crypto_aead_chacha20poly1305_encrypt($plaintext = '',$assocData = '',$nonce = '',$key = '') X-Ref |
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: string $plaintext Message to be encrypted param: string $assocData Authenticated Associated Data (unencrypted) param: string $nonce Number to be used only Once; must be 8 bytes param: string $key Encryption key return: string Ciphertext with a 16-byte Poly1305 message |
crypto_aead_chacha20poly1305_ietf_decrypt($ciphertext = '',$assocData = '',$nonce = '',$key = '') X-Ref |
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: string $ciphertext Encrypted message (with Poly1305 MAC appended) param: string $assocData Authenticated Associated Data (unencrypted) param: string $nonce Number to be used only Once; must be 12 bytes param: string $key Encryption key return: string The original plaintext message |
crypto_aead_chacha20poly1305_keygen() X-Ref |
Return a secure random key for use with the ChaCha20-Poly1305 symmetric AEAD interface. return: string |
crypto_aead_chacha20poly1305_ietf_encrypt($plaintext = '',$assocData = '',$nonce = '',$key = '') X-Ref |
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: string $plaintext Message to be encrypted param: string $assocData Authenticated Associated Data (unencrypted) param: string $nonce Number to be used only Once; must be 8 bytes param: string $key Encryption key return: string Ciphertext with a 16-byte Poly1305 message |
crypto_aead_chacha20poly1305_ietf_keygen() X-Ref |
Return a secure random key for use with the ChaCha20-Poly1305 symmetric AEAD interface. (IETF version) return: string |
crypto_aead_xchacha20poly1305_ietf_decrypt($ciphertext = '',$assocData = '',$nonce = '',$key = '',$dontFallback = false) X-Ref |
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: string $ciphertext Encrypted message (with Poly1305 MAC appended) param: string $assocData Authenticated Associated Data (unencrypted) param: string $nonce Number to be used only Once; must be 8 bytes param: string $key Encryption key param: bool $dontFallback Don't fallback to ext/sodium return: string|bool The original plaintext message |
crypto_aead_xchacha20poly1305_ietf_encrypt($plaintext = '',$assocData = '',$nonce = '',$key = '',$dontFallback = false) X-Ref |
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: string $plaintext Message to be encrypted param: string $assocData Authenticated Associated Data (unencrypted) param: string $nonce Number to be used only Once; must be 8 bytes param: string $key Encryption key param: bool $dontFallback Don't fallback to ext/sodium return: string Ciphertext with a 16-byte Poly1305 message |
crypto_aead_xchacha20poly1305_ietf_keygen() X-Ref |
Return a secure random key for use with the XChaCha20-Poly1305 symmetric AEAD interface. return: string |
crypto_auth($message,$key) X-Ref |
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: string $message Message to be authenticated param: string $key Symmetric authentication key return: string Message authentication code |
crypto_auth_keygen() X-Ref |
return: string |
crypto_auth_verify($mac,$message,$key) X-Ref |
Verify the MAC of a message previously authenticated with crypto_auth. param: string $mac Message authentication code param: string $message Message whose authenticity you are attempting to param: string $key Symmetric authentication key return: bool TRUE if authenticated, FALSE otherwise |
crypto_box($plaintext,$nonce,$keypair) X-Ref |
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: string $plaintext The message to be encrypted param: string $nonce A Number to only be used Once; must be 24 bytes param: string $keypair Your secret key and your recipient's public key return: string Ciphertext with 16-byte Poly1305 MAC |
crypto_box_seal($plaintext,$publicKey) X-Ref |
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: string $plaintext Message to be sealed param: string $publicKey Your recipient's public key return: string Sealed message that only your recipient can |
crypto_box_seal_open($ciphertext,$keypair) X-Ref |
Opens a message encrypted with crypto_box_seal(). Requires the recipient's keypair (sk || pk) to decrypt successfully. This validates ciphertext integrity. param: string $ciphertext Sealed message to be opened param: string $keypair Your crypto_box keypair return: string The original plaintext message |
crypto_box_keypair() X-Ref |
Generate a new random X25519 keypair. return: string A 64-byte string; the first 32 are your secret key, while |
crypto_box_keypair_from_secretkey_and_publickey($secretKey,$publicKey) X-Ref |
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: string $secretKey Secret key param: string $publicKey Public key return: string Keypair |
crypto_box_open($ciphertext,$nonce,$keypair) X-Ref |
Decrypt a message previously encrypted with crypto_box(). param: string $ciphertext Encrypted message param: string $nonce Number to only be used Once; must be 24 bytes param: string $keypair Your secret key and the sender's public key return: string The original plaintext message |
crypto_box_publickey($keypair) X-Ref |
Extract the public key from a crypto_box keypair. param: string $keypair Keypair containing secret and public key return: string Your crypto_box public key |
crypto_box_publickey_from_secretkey($secretKey) X-Ref |
Calculate the X25519 public key from a given X25519 secret key. param: string $secretKey Any X25519 secret key return: string The corresponding X25519 public key |
crypto_box_secretkey($keypair) X-Ref |
Extract the secret key from a crypto_box keypair. param: string $keypair return: string Your crypto_box secret key |
crypto_box_seed_keypair($seed) X-Ref |
Generate an X25519 keypair from a seed. param: string $seed return: string |
crypto_generichash($message,$key = '',$length = self::CRYPTO_GENERICHASH_BYTES) X-Ref |
Calculates a BLAKE2b hash, with an optional key. param: string $message The message to be hashed param: string|null $key If specified, must be a string between 16 param: int $length Output length in bytes; must be between 16 return: string Raw binary |
crypto_generichash_final(&$ctx,$length = self::CRYPTO_GENERICHASH_BYTES) X-Ref |
Get the final BLAKE2b hash output for a given context. param: string $ctx BLAKE2 hashing context. Generated by crypto_generichash_init(). param: int $length Hash output size. return: string Final BLAKE2b hash. |
crypto_generichash_init($key = '',$length = self::CRYPTO_GENERICHASH_BYTES) X-Ref |
Initialize a BLAKE2b hashing context, for use in a streaming interface. param: string|null $key If specified must be a string between 16 and 64 bytes param: int $length The size of the desired hash output return: string A BLAKE2 hashing context, encoded as a string |
crypto_generichash_init_salt_personal($key = '',$length = self::CRYPTO_GENERICHASH_BYTES,$salt = '',$personal = '') X-Ref |
Initialize a BLAKE2b hashing context, for use in a streaming interface. param: string|null $key If specified must be a string between 16 and 64 bytes param: int $length The size of the desired hash output param: string $salt Salt (up to 16 bytes) param: string $personal Personalization string (up to 16 bytes) return: string A BLAKE2 hashing context, encoded as a string |
crypto_generichash_update(&$ctx,$message) X-Ref |
Update a BLAKE2b hashing context with additional data. param: string $ctx BLAKE2 hashing context. Generated by crypto_generichash_init(). param: -out string $ctx param: string $message The message to append to the existing hash state. return: void |
crypto_generichash_keygen() X-Ref |
return: string |
crypto_kdf_derive_from_key($subkey_len,$subkey_id,$context,$key) X-Ref |
param: int $subkey_len param: int $subkey_id param: string $context param: string $key return: string |
crypto_kdf_keygen() X-Ref |
return: string |
crypto_kx($my_secret,$their_public,$client_public,$server_public,$dontFallback = false) X-Ref |
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: string $my_secret param: string $their_public param: string $client_public param: string $server_public param: bool $dontFallback return: string |
crypto_kx_seed_keypair($seed) X-Ref |
param: string $seed return: string |
crypto_kx_keypair() X-Ref |
return: string |
crypto_kx_client_session_keys($keypair,$serverPublicKey) X-Ref |
param: string $keypair param: string $serverPublicKey return: array{0: string, 1: string} |
crypto_kx_server_session_keys($keypair,$clientPublicKey) X-Ref |
param: string $keypair param: string $clientPublicKey return: array{0: string, 1: string} |
crypto_kx_secretkey($kp) X-Ref |
param: string $kp return: string |
crypto_kx_publickey($kp) X-Ref |
param: string $kp return: string |
crypto_pwhash($outlen,$passwd,$salt,$opslimit,$memlimit,$alg = null) X-Ref |
param: int $outlen param: string $passwd param: string $salt param: int $opslimit param: int $memlimit param: int|null $alg return: string |
crypto_pwhash_is_available() X-Ref |
!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. return: bool |
crypto_pwhash_str($passwd,$opslimit,$memlimit) X-Ref |
param: string $passwd param: int $opslimit param: int $memlimit return: string |
crypto_pwhash_str_needs_rehash($hash,$opslimit,$memlimit) X-Ref |
Do we need to rehash this password? param: string $hash param: int $opslimit param: int $memlimit return: bool |
crypto_pwhash_str_verify($passwd,$hash) X-Ref |
param: string $passwd param: string $hash return: bool |
crypto_pwhash_scryptsalsa208sha256($outlen,$passwd,$salt,$opslimit,$memlimit) X-Ref |
param: int $outlen param: string $passwd param: string $salt param: int $opslimit param: int $memlimit return: string |
crypto_pwhash_scryptsalsa208sha256_is_available() X-Ref |
!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. return: bool |
crypto_pwhash_scryptsalsa208sha256_str($passwd,$opslimit,$memlimit) X-Ref |
param: string $passwd param: int $opslimit param: int $memlimit return: string |
crypto_pwhash_scryptsalsa208sha256_str_verify($passwd,$hash) X-Ref |
param: string $passwd param: string $hash return: bool |
crypto_scalarmult($secretKey,$publicKey) X-Ref |
Calculate the shared secret between your secret key and your recipient's public key. Algorithm: X25519 (ECDH over Curve25519) param: string $secretKey param: string $publicKey return: string |
crypto_scalarmult_base($secretKey) X-Ref |
Calculate an X25519 public key from an X25519 secret key. param: string $secretKey return: string |
crypto_secretbox($plaintext,$nonce,$key) X-Ref |
Authenticated symmetric-key encryption. Algorithm: XSalsa20-Poly1305 param: string $plaintext The message you're encrypting param: string $nonce A Number to be used Once; must be 24 bytes param: string $key Symmetric encryption key return: string Ciphertext with Poly1305 MAC |
crypto_secretbox_open($ciphertext,$nonce,$key) X-Ref |
Decrypts a message previously encrypted with crypto_secretbox(). param: string $ciphertext Ciphertext with Poly1305 MAC param: string $nonce A Number to be used Once; must be 24 bytes param: string $key Symmetric encryption key return: string Original plaintext message |
crypto_secretbox_keygen() X-Ref |
Return a secure random key for use with crypto_secretbox return: string |
crypto_secretbox_xchacha20poly1305($plaintext, $nonce, $key) X-Ref |
Authenticated symmetric-key encryption. Algorithm: XChaCha20-Poly1305 param: string $plaintext The message you're encrypting param: string $nonce A Number to be used Once; must be 24 bytes param: string $key Symmetric encryption key return: string Ciphertext with Poly1305 MAC |
crypto_secretbox_xchacha20poly1305_open($ciphertext,$nonce,$key) X-Ref |
Decrypts a message previously encrypted with crypto_secretbox_xchacha20poly1305(). param: string $ciphertext Ciphertext with Poly1305 MAC param: string $nonce A Number to be used Once; must be 24 bytes param: string $key Symmetric encryption key return: string Original plaintext message |
crypto_secretstream_xchacha20poly1305_init_push($key) X-Ref |
param: string $key return: array<int, string> Returns a state and a header. |
crypto_secretstream_xchacha20poly1305_init_pull($header,$key) X-Ref |
param: string $header param: string $key return: string Returns a state. |
crypto_secretstream_xchacha20poly1305_push(&$state,$msg,$aad = '',$tag = 0) X-Ref |
param: string $state param: string $msg param: string $aad param: int $tag return: string |
crypto_secretstream_xchacha20poly1305_pull(&$state,$msg,$aad = '') X-Ref |
param: string $state param: string $msg param: string $aad return: bool|array{0: string, 1: int} |
crypto_secretstream_xchacha20poly1305_keygen() X-Ref |
return: string |
crypto_secretstream_xchacha20poly1305_rekey(&$state) X-Ref |
param: string $state return: void |
crypto_shorthash($message,$key) X-Ref |
Calculates a SipHash-2-4 hash of a message for a given key. param: string $message Input message param: string $key SipHash-2-4 key return: string Hash |
crypto_shorthash_keygen() X-Ref |
Return a secure random key for use with crypto_shorthash return: string |
crypto_sign($message,$secretKey) X-Ref |
Returns a signed message. You probably want crypto_sign_detached() instead, which only returns the signature. Algorithm: Ed25519 (EdDSA over Curve25519) param: string $message Message to be signed. param: string $secretKey Secret signing key. return: string Signed message (signature is prefixed). |
crypto_sign_open($signedMessage,$publicKey) X-Ref |
Validates a signed message then returns the message. param: string $signedMessage A signed message param: string $publicKey A public key return: string The original message (if the signature is |
crypto_sign_keypair() X-Ref |
Generate a new random Ed25519 keypair. return: string |
crypto_sign_keypair_from_secretkey_and_publickey($sk,$pk) X-Ref |
param: string $sk param: string $pk return: string |
crypto_sign_seed_keypair($seed) X-Ref |
Generate an Ed25519 keypair from a seed. param: string $seed Input seed return: string Keypair |
crypto_sign_publickey($keypair) X-Ref |
Extract an Ed25519 public key from an Ed25519 keypair. param: string $keypair Keypair return: string Public key |
crypto_sign_publickey_from_secretkey($secretKey) X-Ref |
Calculate an Ed25519 public key from an Ed25519 secret key. param: string $secretKey Your Ed25519 secret key return: string The corresponding Ed25519 public key |
crypto_sign_secretkey($keypair) X-Ref |
Extract an Ed25519 secret key from an Ed25519 keypair. param: string $keypair Keypair return: string Secret key |
crypto_sign_detached($message,$secretKey) X-Ref |
Calculate the Ed25519 signature of a message and return ONLY the signature. Algorithm: Ed25519 (EdDSA over Curve25519) param: string $message Message to be signed param: string $secretKey Secret signing key return: string Digital signature |
crypto_sign_verify_detached($signature, $message, $publicKey) X-Ref |
Verify the Ed25519 signature of a message. param: string $signature Digital sginature param: string $message Message to be verified param: string $publicKey Public key return: bool TRUE if this signature is good for this public key; |
crypto_sign_ed25519_pk_to_curve25519($pk) X-Ref |
Convert an Ed25519 public key to a Curve25519 public key param: string $pk return: string |
crypto_sign_ed25519_sk_to_curve25519($sk) X-Ref |
Convert an Ed25519 secret key to a Curve25519 secret key param: string $sk return: string |
crypto_stream($len,$nonce,$key) X-Ref |
Expand a key and nonce into a keystream of pseudorandom bytes. param: int $len Number of bytes desired param: string $nonce Number to be used Once; must be 24 bytes param: string $key XSalsa20 key return: string Pseudorandom stream that can be XORed with messages |
crypto_stream_xor($message,$nonce,$key) X-Ref |
DANGER! UNAUTHENTICATED ENCRYPTION! Unless you are following expert advice, do not use this feature. Algorithm: XSalsa20 This DOES NOT provide ciphertext integrity. param: string $message Plaintext message param: string $nonce Number to be used Once; must be 24 bytes param: string $key Encryption key return: string Encrypted text which is vulnerable to chosen- |
crypto_stream_keygen() X-Ref |
Return a secure random key for use with crypto_stream return: string |
crypto_stream_xchacha20($len,$nonce,$key,$dontFallback = false) X-Ref |
Expand a key and nonce into a keystream of pseudorandom bytes. param: int $len Number of bytes desired param: string $nonce Number to be used Once; must be 24 bytes param: string $key XChaCha20 key param: bool $dontFallback return: string Pseudorandom stream that can be XORed with messages |
crypto_stream_xchacha20_xor($message,$nonce,$key,$dontFallback = false) X-Ref |
DANGER! UNAUTHENTICATED ENCRYPTION! Unless you are following expert advice, do not use this feature. Algorithm: XChaCha20 This DOES NOT provide ciphertext integrity. param: string $message Plaintext message param: string $nonce Number to be used Once; must be 24 bytes param: string $key Encryption key param: bool $dontFallback return: string Encrypted text which is vulnerable to chosen- |
crypto_stream_xchacha20_xor_ic($message,$nonce,$counter,$key,$dontFallback = false) X-Ref |
DANGER! UNAUTHENTICATED ENCRYPTION! Unless you are following expert advice, do not use this feature. Algorithm: XChaCha20 This DOES NOT provide ciphertext integrity. param: string $message Plaintext message param: string $nonce Number to be used Once; must be 24 bytes param: int $counter param: string $key Encryption key param: bool $dontFallback return: string Encrypted text which is vulnerable to chosen- |
crypto_stream_xchacha20_keygen() X-Ref |
Return a secure random key for use with crypto_stream_xchacha20 return: string |
hex2bin($string,$ignore = '') X-Ref |
Cache-timing-safe implementation of hex2bin(). param: string $string Hexadecimal string param: string $ignore List of characters to ignore; useful for whitespace return: string Raw binary string |
increment(&$var) X-Ref |
Increase a string (little endian) param: string $var return: void |
is_zero($str) X-Ref |
param: string $str return: bool |
library_version_major() X-Ref |
The equivalent to the libsodium minor version we aim to be compatible with (sans pwhash and memzero). return: int |
library_version_minor() X-Ref |
The equivalent to the libsodium minor version we aim to be compatible with (sans pwhash and memzero). return: int |
memcmp($left,$right) X-Ref |
Compare two strings. param: string $left param: string $right return: int |
memzero(&$var) X-Ref |
It's actually not possible to zero memory buffers in PHP. You need the native library for that. param: string|null $var param: -out string|null $var return: void |
pad($unpadded,$blockSize,$dontFallback = false) X-Ref |
param: string $unpadded param: int $blockSize param: bool $dontFallback return: string |
unpad($padded,$blockSize,$dontFallback = false) X-Ref |
param: string $padded param: int $blockSize param: bool $dontFallback return: string |
polyfill_is_fast() X-Ref |
Will sodium_compat run fast on the current hardware and PHP configuration? return: bool |
randombytes_buf($numBytes) X-Ref |
Generate a string of bytes from the kernel's CSPRNG. Proudly uses /dev/urandom (if getrandom(2) is not available). param: int $numBytes return: string |
randombytes_uniform($range) X-Ref |
Generate an integer between 0 and $range (non-inclusive). param: int $range return: int |
randombytes_random16() X-Ref |
Generate a random 16-bit integer. return: int |
ristretto255_is_valid_point($p,$dontFallback = false) X-Ref |
param: string $p param: bool $dontFallback return: bool |
ristretto255_add($p,$q,$dontFallback = false) X-Ref |
param: string $p param: string $q param: bool $dontFallback return: string |
ristretto255_sub($p,$q,$dontFallback = false) X-Ref |
param: string $p param: string $q param: bool $dontFallback return: string |
ristretto255_from_hash($r,$dontFallback = false) X-Ref |
param: string $r param: bool $dontFallback return: string |
ristretto255_random($dontFallback = false) X-Ref |
param: bool $dontFallback return: string |
ristretto255_scalar_random($dontFallback = false) X-Ref |
param: bool $dontFallback return: string |
ristretto255_scalar_invert($s,$dontFallback = false) X-Ref |
param: string $s param: bool $dontFallback return: string |
ristretto255_scalar_negate($s,$dontFallback = false) X-Ref |
param: string $s param: bool $dontFallback return: string |
ristretto255_scalar_complement($s,$dontFallback = false) X-Ref |
param: string $s param: bool $dontFallback return: string |
ristretto255_scalar_add($x,$y,$dontFallback = false) X-Ref |
param: string $x param: string $y param: bool $dontFallback return: string |
ristretto255_scalar_sub($x,$y,$dontFallback = false) X-Ref |
param: string $x param: string $y param: bool $dontFallback return: string |
ristretto255_scalar_mul($x,$y,$dontFallback = false) X-Ref |
param: string $x param: string $y param: bool $dontFallback return: string |
scalarmult_ristretto255($n,$p,$dontFallback = false) X-Ref |
param: string $n param: string $p param: bool $dontFallback return: string |
scalarmult_ristretto255_base($n,$dontFallback = false) X-Ref |
param: string $n param: string $p param: bool $dontFallback return: string |
ristretto255_scalar_reduce($s,$dontFallback = false) X-Ref |
param: string $s param: bool $dontFallback return: string |
runtime_speed_test($iterations, $maxTimeout) X-Ref |
Runtime testing method for 32-bit platforms. 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. param: int $iterations Number of multiplications to attempt param: int $maxTimeout Milliseconds return: bool TRUE if we're fast enough, FALSE is not |
sub(&$val,$addv) X-Ref |
Add two numbers (little-endian unsigned), storing the value in the first parameter. This mutates $val. param: string $val param: string $addv return: void |
version_string() X-Ref |
This emulates libsodium's version_string() function, except ours is prefixed with 'polyfill-'. return: string |
use_fallback($sodium_func_name = '') X-Ref |
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: string $sodium_func_name return: bool |
useNewSodiumAPI() X-Ref |
Libsodium as implemented in PHP 7.2 and/or ext/sodium (via PECL) return: bool |
Generated : Thu Nov 21 08:20:01 2024 | Cross-referenced by PHPXref |