[ 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. return: void param: string $val param: string $addv |
base642bin($encoded,$variant,$ignore = '') X-Ref |
return: string param: string $encoded param: int $variant param: string $ignore |
bin2base64($decoded,$variant) X-Ref |
return: string param: string $decoded param: int $variant |
bin2hex($string) X-Ref |
Cache-timing-safe implementation of bin2hex(). return: string A hexadecimal-encoded string param: string $string A string (probably raw binary) |
compare($left,$right) X-Ref |
Compare two strings, in constant-time. Compared to memcmp(), compare() is more useful for sorting. return: int If < 0 if the left operand is less than the right param: string $left The left operand; must be a string param: string $right The right operand; must be a string |
crypto_aead_aegis128l_decrypt($ciphertext = '',$assocData = '',$nonce = '',$key = '') X-Ref |
Authenticated Encryption with Associated Data: Decryption Algorithm: AEGIS-128L return: string The original plaintext message 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 |
crypto_aead_aegis128l_encrypt($plaintext = '',$assocData = '',$nonce = '',$key = '') X-Ref |
Authenticated Encryption with Associated Data: Encryption Algorithm: AEGIS-128L return: string Ciphertext with 32-byte authentication tag appended 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 |
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 return: string The original plaintext message 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 |
crypto_aead_aegis256_encrypt($plaintext = '',$assocData = '',$nonce = '',$key = '') X-Ref |
Authenticated Encryption with Associated Data: Encryption Algorithm: AEGIS-256 return: string Ciphertext with 32-byte authentication tag appended 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 |
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. return: string|bool The original plaintext message 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 |
crypto_aead_aes256gcm_encrypt($plaintext = '',$assocData = '',$nonce = '',$key = '') X-Ref |
Authenticated Encryption with Associated Data: Encryption Algorithm: AES-256-GCM return: string Ciphertext with a 16-byte GCM message 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 |
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. return: string The original plaintext message 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 |
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. return: string Ciphertext with a 16-byte Poly1305 message 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 |
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. return: string The original plaintext message 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 |
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. return: string Ciphertext with a 16-byte Poly1305 message 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 |
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. return: string|bool The original plaintext message 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 |
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. return: string Ciphertext with a 16-byte Poly1305 message 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 |
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). return: string Message authentication code param: string $message Message to be authenticated param: string $key Symmetric authentication key |
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. return: bool TRUE if authenticated, FALSE otherwise param: string $mac Message authentication code param: string $message Message whose authenticity you are attempting to param: string $key Symmetric authentication key |
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. return: string Ciphertext with 16-byte Poly1305 MAC 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 |
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. return: string Sealed message that only your recipient can param: string $plaintext Message to be sealed param: string $publicKey Your recipient's public key |
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. return: string The original plaintext message param: string $ciphertext Sealed message to be opened param: string $keypair Your crypto_box keypair |
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. return: string Keypair param: string $secretKey Secret key param: string $publicKey Public key |
crypto_box_open($ciphertext,$nonce,$keypair) X-Ref |
Decrypt a message previously encrypted with crypto_box(). return: string The original plaintext message 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 |
crypto_box_publickey($keypair) X-Ref |
Extract the public key from a crypto_box keypair. return: string Your crypto_box public key param: string $keypair Keypair containing secret and public key |
crypto_box_publickey_from_secretkey($secretKey) X-Ref |
Calculate the X25519 public key from a given X25519 secret key. return: string The corresponding X25519 public key param: string $secretKey Any X25519 secret key |
crypto_box_secretkey($keypair) X-Ref |
Extract the secret key from a crypto_box keypair. return: string Your crypto_box secret key param: string $keypair |
crypto_box_seed_keypair($seed) X-Ref |
Generate an X25519 keypair from a seed. return: string param: string $seed |
crypto_generichash($message,$key = '',$length = self::CRYPTO_GENERICHASH_BYTES) X-Ref |
Calculates a BLAKE2b hash, with an optional key. return: string Raw binary 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 |
crypto_generichash_final(&$ctx,$length = self::CRYPTO_GENERICHASH_BYTES) X-Ref |
Get the final BLAKE2b hash output for a given context. return: string Final BLAKE2b hash. param: string $ctx BLAKE2 hashing context. Generated by crypto_generichash_init(). param: int $length Hash output size. |
crypto_generichash_init($key = '',$length = self::CRYPTO_GENERICHASH_BYTES) X-Ref |
Initialize a BLAKE2b hashing context, for use in a streaming interface. return: string A BLAKE2 hashing context, encoded as a string 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 |
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. return: string A BLAKE2 hashing context, encoded as a string 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) |
crypto_generichash_update(&$ctx,$message) X-Ref |
Update a BLAKE2b hashing context with additional data. return: void 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. |
crypto_generichash_keygen() X-Ref |
return: string |
crypto_kdf_derive_from_key($subkey_len,$subkey_id,$context,$key) X-Ref |
return: string param: int $subkey_len param: int $subkey_id param: string $context param: string $key |
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. return: string param: string $my_secret param: string $their_public param: string $client_public param: string $server_public param: bool $dontFallback |
crypto_kx_seed_keypair($seed) X-Ref |
return: string param: string $seed |
crypto_kx_keypair() X-Ref |
return: string |
crypto_kx_client_session_keys($keypair,$serverPublicKey) X-Ref |
return: array{0: string, 1: string} param: string $keypair param: string $serverPublicKey |
crypto_kx_server_session_keys($keypair,$clientPublicKey) X-Ref |
return: array{0: string, 1: string} param: string $keypair param: string $clientPublicKey |
crypto_kx_secretkey($kp) X-Ref |
return: string param: string $kp |
crypto_kx_publickey($kp) X-Ref |
return: string param: string $kp |
crypto_pwhash($outlen,$passwd,$salt,$opslimit,$memlimit,$alg = null) X-Ref |
return: string param: int $outlen param: string $passwd param: string $salt param: int $opslimit param: int $memlimit param: int|null $alg |
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 |
return: string param: string $passwd param: int $opslimit param: int $memlimit |
crypto_pwhash_str_needs_rehash($hash,$opslimit,$memlimit) X-Ref |
Do we need to rehash this password? return: bool param: string $hash param: int $opslimit param: int $memlimit |
crypto_pwhash_str_verify($passwd,$hash) X-Ref |
return: bool param: string $passwd param: string $hash |
crypto_pwhash_scryptsalsa208sha256($outlen,$passwd,$salt,$opslimit,$memlimit) X-Ref |
return: string param: int $outlen param: string $passwd param: string $salt param: int $opslimit param: int $memlimit |
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 |
return: string param: string $passwd param: int $opslimit param: int $memlimit |
crypto_pwhash_scryptsalsa208sha256_str_verify($passwd,$hash) X-Ref |
return: bool param: string $passwd param: string $hash |
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) return: string param: string $secretKey param: string $publicKey |
crypto_scalarmult_base($secretKey) X-Ref |
Calculate an X25519 public key from an X25519 secret key. return: string param: string $secretKey |
crypto_secretbox($plaintext,$nonce,$key) X-Ref |
Authenticated symmetric-key encryption. Algorithm: XSalsa20-Poly1305 return: string Ciphertext with Poly1305 MAC 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 |
crypto_secretbox_open($ciphertext,$nonce,$key) X-Ref |
Decrypts a message previously encrypted with crypto_secretbox(). return: string Original plaintext message 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 |
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 return: string Ciphertext with Poly1305 MAC 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 |
crypto_secretbox_xchacha20poly1305_open($ciphertext,$nonce,$key) X-Ref |
Decrypts a message previously encrypted with crypto_secretbox_xchacha20poly1305(). return: string Original plaintext message 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 |
crypto_secretstream_xchacha20poly1305_init_push($key) X-Ref |
return: array<int, string> Returns a state and a header. param: string $key |
crypto_secretstream_xchacha20poly1305_init_pull($header,$key) X-Ref |
return: string Returns a state. param: string $header param: string $key |
crypto_secretstream_xchacha20poly1305_push(&$state,$msg,$aad = '',$tag = 0) X-Ref |
return: string param: string $state param: string $msg param: string $aad param: int $tag |
crypto_secretstream_xchacha20poly1305_pull(&$state,$msg,$aad = '') X-Ref |
return: bool|array{0: string, 1: int} param: string $state param: string $msg param: string $aad |
crypto_secretstream_xchacha20poly1305_keygen() X-Ref |
return: string |
crypto_secretstream_xchacha20poly1305_rekey(&$state) X-Ref |
return: void param: string $state |
crypto_shorthash($message,$key) X-Ref |
Calculates a SipHash-2-4 hash of a message for a given key. return: string Hash param: string $message Input message param: string $key SipHash-2-4 key |
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) return: string Signed message (signature is prefixed). param: string $message Message to be signed. param: string $secretKey Secret signing key. |
crypto_sign_open($signedMessage,$publicKey) X-Ref |
Validates a signed message then returns the message. return: string The original message (if the signature is param: string $signedMessage A signed message param: string $publicKey A public key |
crypto_sign_keypair() X-Ref |
Generate a new random Ed25519 keypair. return: string |
crypto_sign_keypair_from_secretkey_and_publickey($sk,$pk) X-Ref |
return: string param: string $sk param: string $pk |
crypto_sign_seed_keypair($seed) X-Ref |
Generate an Ed25519 keypair from a seed. return: string Keypair param: string $seed Input seed |
crypto_sign_publickey($keypair) X-Ref |
Extract an Ed25519 public key from an Ed25519 keypair. return: string Public key param: string $keypair Keypair |
crypto_sign_publickey_from_secretkey($secretKey) X-Ref |
Calculate an Ed25519 public key from an Ed25519 secret key. return: string The corresponding Ed25519 public key param: string $secretKey Your Ed25519 secret key |
crypto_sign_secretkey($keypair) X-Ref |
Extract an Ed25519 secret key from an Ed25519 keypair. return: string Secret key param: string $keypair Keypair |
crypto_sign_detached($message,$secretKey) X-Ref |
Calculate the Ed25519 signature of a message and return ONLY the signature. Algorithm: Ed25519 (EdDSA over Curve25519) return: string Digital signature param: string $message Message to be signed param: string $secretKey Secret signing key |
crypto_sign_verify_detached($signature, $message, $publicKey) X-Ref |
Verify the Ed25519 signature of a message. return: bool TRUE if this signature is good for this public key; param: string $signature Digital sginature param: string $message Message to be verified param: string $publicKey Public key |
crypto_sign_ed25519_pk_to_curve25519($pk) X-Ref |
Convert an Ed25519 public key to a Curve25519 public key return: string param: string $pk |
crypto_sign_ed25519_sk_to_curve25519($sk) X-Ref |
Convert an Ed25519 secret key to a Curve25519 secret key return: string param: string $sk |
crypto_stream($len,$nonce,$key) X-Ref |
Expand a key and nonce into a keystream of pseudorandom bytes. return: string Pseudorandom stream that can be XORed with messages param: int $len Number of bytes desired param: string $nonce Number to be used Once; must be 24 bytes param: string $key XSalsa20 key |
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. return: string Encrypted text which is vulnerable to chosen- param: string $message Plaintext message param: string $nonce Number to be used Once; must be 24 bytes param: string $key Encryption key |
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. return: string Pseudorandom stream that can be XORed with messages 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 |
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. return: string Encrypted text which is vulnerable to chosen- 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 |
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. return: string Encrypted text which is vulnerable to chosen- 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 |
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(). return: string Raw binary string param: string $string Hexadecimal string param: string $ignore List of characters to ignore; useful for whitespace |
increment(&$var) X-Ref |
Increase a string (little endian) return: void param: string $var |
is_zero($str) X-Ref |
return: bool param: string $str |
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. return: int param: string $left param: string $right |
memzero(&$var) X-Ref |
It's actually not possible to zero memory buffers in PHP. You need the native library for that. return: void param: string|null $var param: -out string|null $var |
pad($unpadded,$blockSize,$dontFallback = false) X-Ref |
return: string param: string $unpadded param: int $blockSize param: bool $dontFallback |
unpad($padded,$blockSize,$dontFallback = false) X-Ref |
return: string param: string $padded param: int $blockSize param: bool $dontFallback |
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). return: string param: int $numBytes |
randombytes_uniform($range) X-Ref |
Generate an integer between 0 and $range (non-inclusive). return: int param: int $range |
randombytes_random16() X-Ref |
Generate a random 16-bit integer. return: int |
ristretto255_is_valid_point($p,$dontFallback = false) X-Ref |
return: bool param: string $p param: bool $dontFallback |
ristretto255_add($p,$q,$dontFallback = false) X-Ref |
return: string param: string $p param: string $q param: bool $dontFallback |
ristretto255_sub($p,$q,$dontFallback = false) X-Ref |
return: string param: string $p param: string $q param: bool $dontFallback |
ristretto255_from_hash($r,$dontFallback = false) X-Ref |
return: string param: string $r param: bool $dontFallback |
ristretto255_random($dontFallback = false) X-Ref |
return: string param: bool $dontFallback |
ristretto255_scalar_random($dontFallback = false) X-Ref |
return: string param: bool $dontFallback |
ristretto255_scalar_invert($s,$dontFallback = false) X-Ref |
return: string param: string $s param: bool $dontFallback |
ristretto255_scalar_negate($s,$dontFallback = false) X-Ref |
return: string param: string $s param: bool $dontFallback |
ristretto255_scalar_complement($s,$dontFallback = false) X-Ref |
return: string param: string $s param: bool $dontFallback |
ristretto255_scalar_add($x,$y,$dontFallback = false) X-Ref |
return: string param: string $x param: string $y param: bool $dontFallback |
ristretto255_scalar_sub($x,$y,$dontFallback = false) X-Ref |
return: string param: string $x param: string $y param: bool $dontFallback |
ristretto255_scalar_mul($x,$y,$dontFallback = false) X-Ref |
return: string param: string $x param: string $y param: bool $dontFallback |
scalarmult_ristretto255($n,$p,$dontFallback = false) X-Ref |
return: string param: string $n param: string $p param: bool $dontFallback |
scalarmult_ristretto255_base($n,$dontFallback = false) X-Ref |
return: string param: string $n param: string $p param: bool $dontFallback |
ristretto255_scalar_reduce($s,$dontFallback = false) X-Ref |
return: string param: string $s param: bool $dontFallback |
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. return: bool TRUE if we're fast enough, FALSE is not param: int $iterations Number of multiplications to attempt param: int $maxTimeout Milliseconds |
sub(&$val,$addv) X-Ref |
Add two numbers (little-endian unsigned), storing the value in the first parameter. This mutates $val. return: void param: string $val param: string $addv |
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. return: bool param: string $sodium_func_name |
useNewSodiumAPI() X-Ref |
Libsodium as implemented in PHP 7.2 and/or ext/sodium (via PECL) return: bool |
Generated : Sat Dec 21 08:20:01 2024 | Cross-referenced by PHPXref |