Edit File by line
/home/barbar84/public_h.../wp-inclu.../sodium_c.../lib
File: php72compat.php
<?php
[0] Fix | Delete
[1] Fix | Delete
require_once dirname(dirname(__FILE__)) . '/autoload.php';
[2] Fix | Delete
[3] Fix | Delete
/**
[4] Fix | Delete
* This file will monkey patch the pure-PHP implementation in place of the
[5] Fix | Delete
* PECL functions and constants, but only if they do not already exist.
[6] Fix | Delete
*
[7] Fix | Delete
* Thus, the functions or constants just proxy to the appropriate
[8] Fix | Delete
* ParagonIE_Sodium_Compat method or class constant, respectively.
[9] Fix | Delete
*/
[10] Fix | Delete
foreach (array(
[11] Fix | Delete
'BASE64_VARIANT_ORIGINAL',
[12] Fix | Delete
'BASE64_VARIANT_ORIGINAL_NO_PADDING',
[13] Fix | Delete
'BASE64_VARIANT_URLSAFE',
[14] Fix | Delete
'BASE64_VARIANT_URLSAFE_NO_PADDING',
[15] Fix | Delete
'CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES',
[16] Fix | Delete
'CRYPTO_AEAD_CHACHA20POLY1305_NSECBYTES',
[17] Fix | Delete
'CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES',
[18] Fix | Delete
'CRYPTO_AEAD_CHACHA20POLY1305_ABYTES',
[19] Fix | Delete
'CRYPTO_AEAD_AES256GCM_KEYBYTES',
[20] Fix | Delete
'CRYPTO_AEAD_AES256GCM_NSECBYTES',
[21] Fix | Delete
'CRYPTO_AEAD_AES256GCM_NPUBBYTES',
[22] Fix | Delete
'CRYPTO_AEAD_AES256GCM_ABYTES',
[23] Fix | Delete
'CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES',
[24] Fix | Delete
'CRYPTO_AEAD_CHACHA20POLY1305_IETF_NSECBYTES',
[25] Fix | Delete
'CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES',
[26] Fix | Delete
'CRYPTO_AEAD_CHACHA20POLY1305_IETF_ABYTES',
[27] Fix | Delete
'CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES',
[28] Fix | Delete
'CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NSECBYTES',
[29] Fix | Delete
'CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES',
[30] Fix | Delete
'CRYPTO_AEAD_XCHACHA20POLY1305_IETF_ABYTES',
[31] Fix | Delete
'CRYPTO_AUTH_BYTES',
[32] Fix | Delete
'CRYPTO_AUTH_KEYBYTES',
[33] Fix | Delete
'CRYPTO_BOX_SEALBYTES',
[34] Fix | Delete
'CRYPTO_BOX_SECRETKEYBYTES',
[35] Fix | Delete
'CRYPTO_BOX_PUBLICKEYBYTES',
[36] Fix | Delete
'CRYPTO_BOX_KEYPAIRBYTES',
[37] Fix | Delete
'CRYPTO_BOX_MACBYTES',
[38] Fix | Delete
'CRYPTO_BOX_NONCEBYTES',
[39] Fix | Delete
'CRYPTO_BOX_SEEDBYTES',
[40] Fix | Delete
'CRYPTO_KDF_BYTES_MIN',
[41] Fix | Delete
'CRYPTO_KDF_BYTES_MAX',
[42] Fix | Delete
'CRYPTO_KDF_CONTEXTBYTES',
[43] Fix | Delete
'CRYPTO_KDF_KEYBYTES',
[44] Fix | Delete
'CRYPTO_KX_BYTES',
[45] Fix | Delete
'CRYPTO_KX_KEYPAIRBYTES',
[46] Fix | Delete
'CRYPTO_KX_PRIMITIVE',
[47] Fix | Delete
'CRYPTO_KX_SEEDBYTES',
[48] Fix | Delete
'CRYPTO_KX_PUBLICKEYBYTES',
[49] Fix | Delete
'CRYPTO_KX_SECRETKEYBYTES',
[50] Fix | Delete
'CRYPTO_KX_SESSIONKEYBYTES',
[51] Fix | Delete
'CRYPTO_GENERICHASH_BYTES',
[52] Fix | Delete
'CRYPTO_GENERICHASH_BYTES_MIN',
[53] Fix | Delete
'CRYPTO_GENERICHASH_BYTES_MAX',
[54] Fix | Delete
'CRYPTO_GENERICHASH_KEYBYTES',
[55] Fix | Delete
'CRYPTO_GENERICHASH_KEYBYTES_MIN',
[56] Fix | Delete
'CRYPTO_GENERICHASH_KEYBYTES_MAX',
[57] Fix | Delete
'CRYPTO_PWHASH_SALTBYTES',
[58] Fix | Delete
'CRYPTO_PWHASH_STRPREFIX',
[59] Fix | Delete
'CRYPTO_PWHASH_ALG_ARGON2I13',
[60] Fix | Delete
'CRYPTO_PWHASH_ALG_ARGON2ID13',
[61] Fix | Delete
'CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE',
[62] Fix | Delete
'CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE',
[63] Fix | Delete
'CRYPTO_PWHASH_MEMLIMIT_MODERATE',
[64] Fix | Delete
'CRYPTO_PWHASH_OPSLIMIT_MODERATE',
[65] Fix | Delete
'CRYPTO_PWHASH_MEMLIMIT_SENSITIVE',
[66] Fix | Delete
'CRYPTO_PWHASH_OPSLIMIT_SENSITIVE',
[67] Fix | Delete
'CRYPTO_PWHASH_SCRYPTSALSA208SHA256_SALTBYTES',
[68] Fix | Delete
'CRYPTO_PWHASH_SCRYPTSALSA208SHA256_STRPREFIX',
[69] Fix | Delete
'CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE',
[70] Fix | Delete
'CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_INTERACTIVE',
[71] Fix | Delete
'CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_SENSITIVE',
[72] Fix | Delete
'CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_SENSITIVE',
[73] Fix | Delete
'CRYPTO_SCALARMULT_BYTES',
[74] Fix | Delete
'CRYPTO_SCALARMULT_SCALARBYTES',
[75] Fix | Delete
'CRYPTO_SHORTHASH_BYTES',
[76] Fix | Delete
'CRYPTO_SHORTHASH_KEYBYTES',
[77] Fix | Delete
'CRYPTO_SECRETBOX_KEYBYTES',
[78] Fix | Delete
'CRYPTO_SECRETBOX_MACBYTES',
[79] Fix | Delete
'CRYPTO_SECRETBOX_NONCEBYTES',
[80] Fix | Delete
'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_ABYTES',
[81] Fix | Delete
'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES',
[82] Fix | Delete
'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES',
[83] Fix | Delete
'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PUSH',
[84] Fix | Delete
'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PULL',
[85] Fix | Delete
'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_REKEY',
[86] Fix | Delete
'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_FINAL',
[87] Fix | Delete
'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_MESSAGEBYTES_MAX',
[88] Fix | Delete
'CRYPTO_SIGN_BYTES',
[89] Fix | Delete
'CRYPTO_SIGN_SEEDBYTES',
[90] Fix | Delete
'CRYPTO_SIGN_PUBLICKEYBYTES',
[91] Fix | Delete
'CRYPTO_SIGN_SECRETKEYBYTES',
[92] Fix | Delete
'CRYPTO_SIGN_KEYPAIRBYTES',
[93] Fix | Delete
'CRYPTO_STREAM_KEYBYTES',
[94] Fix | Delete
'CRYPTO_STREAM_NONCEBYTES',
[95] Fix | Delete
'CRYPTO_STREAM_XCHACHA20_KEYBYTES',
[96] Fix | Delete
'CRYPTO_STREAM_XCHACHA20_NONCEBYTES',
[97] Fix | Delete
'LIBRARY_MAJOR_VERSION',
[98] Fix | Delete
'LIBRARY_MINOR_VERSION',
[99] Fix | Delete
'LIBRARY_VERSION_MAJOR',
[100] Fix | Delete
'LIBRARY_VERSION_MINOR',
[101] Fix | Delete
'VERSION_STRING'
[102] Fix | Delete
) as $constant
[103] Fix | Delete
) {
[104] Fix | Delete
if (!defined("SODIUM_$constant") && defined("ParagonIE_Sodium_Compat::$constant")) {
[105] Fix | Delete
define("SODIUM_$constant", constant("ParagonIE_Sodium_Compat::$constant"));
[106] Fix | Delete
}
[107] Fix | Delete
}
[108] Fix | Delete
if (!is_callable('sodium_add')) {
[109] Fix | Delete
/**
[110] Fix | Delete
* @see ParagonIE_Sodium_Compat::add()
[111] Fix | Delete
* @param string $val
[112] Fix | Delete
* @param string $addv
[113] Fix | Delete
* @return void
[114] Fix | Delete
* @throws SodiumException
[115] Fix | Delete
*/
[116] Fix | Delete
function sodium_add(&$val, $addv)
[117] Fix | Delete
{
[118] Fix | Delete
ParagonIE_Sodium_Compat::add($val, $addv);
[119] Fix | Delete
}
[120] Fix | Delete
}
[121] Fix | Delete
if (!is_callable('sodium_base642bin')) {
[122] Fix | Delete
/**
[123] Fix | Delete
* @see ParagonIE_Sodium_Compat::bin2base64()
[124] Fix | Delete
* @param string $string
[125] Fix | Delete
* @param int $variant
[126] Fix | Delete
* @param string $ignore
[127] Fix | Delete
* @return string
[128] Fix | Delete
* @throws SodiumException
[129] Fix | Delete
* @throws TypeError
[130] Fix | Delete
*/
[131] Fix | Delete
function sodium_base642bin($string, $variant, $ignore ='')
[132] Fix | Delete
{
[133] Fix | Delete
return ParagonIE_Sodium_Compat::base642bin($string, $variant, $ignore);
[134] Fix | Delete
}
[135] Fix | Delete
}
[136] Fix | Delete
if (!is_callable('sodium_bin2base64')) {
[137] Fix | Delete
/**
[138] Fix | Delete
* @see ParagonIE_Sodium_Compat::bin2base64()
[139] Fix | Delete
* @param string $string
[140] Fix | Delete
* @param int $variant
[141] Fix | Delete
* @return string
[142] Fix | Delete
* @throws SodiumException
[143] Fix | Delete
* @throws TypeError
[144] Fix | Delete
*/
[145] Fix | Delete
function sodium_bin2base64($string, $variant)
[146] Fix | Delete
{
[147] Fix | Delete
return ParagonIE_Sodium_Compat::bin2base64($string, $variant);
[148] Fix | Delete
}
[149] Fix | Delete
}
[150] Fix | Delete
if (!is_callable('sodium_bin2hex')) {
[151] Fix | Delete
/**
[152] Fix | Delete
* @see ParagonIE_Sodium_Compat::hex2bin()
[153] Fix | Delete
* @param string $string
[154] Fix | Delete
* @return string
[155] Fix | Delete
* @throws SodiumException
[156] Fix | Delete
* @throws TypeError
[157] Fix | Delete
*/
[158] Fix | Delete
function sodium_bin2hex($string)
[159] Fix | Delete
{
[160] Fix | Delete
return ParagonIE_Sodium_Compat::bin2hex($string);
[161] Fix | Delete
}
[162] Fix | Delete
}
[163] Fix | Delete
if (!is_callable('sodium_compare')) {
[164] Fix | Delete
/**
[165] Fix | Delete
* @see ParagonIE_Sodium_Compat::compare()
[166] Fix | Delete
* @param string $a
[167] Fix | Delete
* @param string $b
[168] Fix | Delete
* @return int
[169] Fix | Delete
* @throws SodiumException
[170] Fix | Delete
* @throws TypeError
[171] Fix | Delete
*/
[172] Fix | Delete
function sodium_compare($a, $b)
[173] Fix | Delete
{
[174] Fix | Delete
return ParagonIE_Sodium_Compat::compare($a, $b);
[175] Fix | Delete
}
[176] Fix | Delete
}
[177] Fix | Delete
if (!is_callable('sodium_crypto_aead_aes256gcm_decrypt')) {
[178] Fix | Delete
/**
[179] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt()
[180] Fix | Delete
* @param string $message
[181] Fix | Delete
* @param string $assocData
[182] Fix | Delete
* @param string $nonce
[183] Fix | Delete
* @param string $key
[184] Fix | Delete
* @return string|bool
[185] Fix | Delete
*/
[186] Fix | Delete
function sodium_crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key)
[187] Fix | Delete
{
[188] Fix | Delete
try {
[189] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key);
[190] Fix | Delete
} catch (Error $ex) {
[191] Fix | Delete
return false;
[192] Fix | Delete
} catch (Exception $ex) {
[193] Fix | Delete
return false;
[194] Fix | Delete
}
[195] Fix | Delete
}
[196] Fix | Delete
}
[197] Fix | Delete
if (!is_callable('sodium_crypto_aead_aes256gcm_encrypt')) {
[198] Fix | Delete
/**
[199] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_encrypt()
[200] Fix | Delete
* @param string $message
[201] Fix | Delete
* @param string $assocData
[202] Fix | Delete
* @param string $nonce
[203] Fix | Delete
* @param string $key
[204] Fix | Delete
* @return string
[205] Fix | Delete
* @throws SodiumException
[206] Fix | Delete
* @throws TypeError
[207] Fix | Delete
*/
[208] Fix | Delete
function sodium_crypto_aead_aes256gcm_encrypt($message, $assocData, $nonce, $key)
[209] Fix | Delete
{
[210] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_encrypt($message, $assocData, $nonce, $key);
[211] Fix | Delete
}
[212] Fix | Delete
}
[213] Fix | Delete
if (!is_callable('sodium_crypto_aead_aes256gcm_is_available')) {
[214] Fix | Delete
/**
[215] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_is_available()
[216] Fix | Delete
* @return bool
[217] Fix | Delete
*/
[218] Fix | Delete
function sodium_crypto_aead_aes256gcm_is_available()
[219] Fix | Delete
{
[220] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_is_available();
[221] Fix | Delete
}
[222] Fix | Delete
}
[223] Fix | Delete
if (!is_callable('sodium_crypto_aead_chacha20poly1305_decrypt')) {
[224] Fix | Delete
/**
[225] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt()
[226] Fix | Delete
* @param string $message
[227] Fix | Delete
* @param string $assocData
[228] Fix | Delete
* @param string $nonce
[229] Fix | Delete
* @param string $key
[230] Fix | Delete
* @return string|bool
[231] Fix | Delete
*/
[232] Fix | Delete
function sodium_crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key)
[233] Fix | Delete
{
[234] Fix | Delete
try {
[235] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key);
[236] Fix | Delete
} catch (Error $ex) {
[237] Fix | Delete
return false;
[238] Fix | Delete
} catch (Exception $ex) {
[239] Fix | Delete
return false;
[240] Fix | Delete
}
[241] Fix | Delete
}
[242] Fix | Delete
}
[243] Fix | Delete
if (!is_callable('sodium_crypto_aead_chacha20poly1305_encrypt')) {
[244] Fix | Delete
/**
[245] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt()
[246] Fix | Delete
* @param string $message
[247] Fix | Delete
* @param string $assocData
[248] Fix | Delete
* @param string $nonce
[249] Fix | Delete
* @param string $key
[250] Fix | Delete
* @return string
[251] Fix | Delete
* @throws SodiumException
[252] Fix | Delete
* @throws TypeError
[253] Fix | Delete
*/
[254] Fix | Delete
function sodium_crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key)
[255] Fix | Delete
{
[256] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key);
[257] Fix | Delete
}
[258] Fix | Delete
}
[259] Fix | Delete
if (!is_callable('sodium_crypto_aead_chacha20poly1305_keygen')) {
[260] Fix | Delete
/**
[261] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_keygen()
[262] Fix | Delete
* @return string
[263] Fix | Delete
* @throws Exception
[264] Fix | Delete
*/
[265] Fix | Delete
function sodium_crypto_aead_chacha20poly1305_keygen()
[266] Fix | Delete
{
[267] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_keygen();
[268] Fix | Delete
}
[269] Fix | Delete
}
[270] Fix | Delete
if (!is_callable('sodium_crypto_aead_chacha20poly1305_ietf_decrypt')) {
[271] Fix | Delete
/**
[272] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt()
[273] Fix | Delete
* @param string $message
[274] Fix | Delete
* @param string $assocData
[275] Fix | Delete
* @param string $nonce
[276] Fix | Delete
* @param string $key
[277] Fix | Delete
* @return string|bool
[278] Fix | Delete
*/
[279] Fix | Delete
function sodium_crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key)
[280] Fix | Delete
{
[281] Fix | Delete
try {
[282] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key);
[283] Fix | Delete
} catch (Error $ex) {
[284] Fix | Delete
return false;
[285] Fix | Delete
} catch (Exception $ex) {
[286] Fix | Delete
return false;
[287] Fix | Delete
}
[288] Fix | Delete
}
[289] Fix | Delete
}
[290] Fix | Delete
if (!is_callable('sodium_crypto_aead_chacha20poly1305_ietf_encrypt')) {
[291] Fix | Delete
/**
[292] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt()
[293] Fix | Delete
* @param string $message
[294] Fix | Delete
* @param string $assocData
[295] Fix | Delete
* @param string $nonce
[296] Fix | Delete
* @param string $key
[297] Fix | Delete
* @return string
[298] Fix | Delete
* @throws SodiumException
[299] Fix | Delete
* @throws TypeError
[300] Fix | Delete
*/
[301] Fix | Delete
function sodium_crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key)
[302] Fix | Delete
{
[303] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key);
[304] Fix | Delete
}
[305] Fix | Delete
}
[306] Fix | Delete
if (!is_callable('sodium_crypto_aead_chacha20poly1305_ietf_keygen')) {
[307] Fix | Delete
/**
[308] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_keygen()
[309] Fix | Delete
* @return string
[310] Fix | Delete
* @throws Exception
[311] Fix | Delete
*/
[312] Fix | Delete
function sodium_crypto_aead_chacha20poly1305_ietf_keygen()
[313] Fix | Delete
{
[314] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_keygen();
[315] Fix | Delete
}
[316] Fix | Delete
}
[317] Fix | Delete
if (!is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_decrypt')) {
[318] Fix | Delete
/**
[319] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt()
[320] Fix | Delete
* @param string $message
[321] Fix | Delete
* @param string $assocData
[322] Fix | Delete
* @param string $nonce
[323] Fix | Delete
* @param string $key
[324] Fix | Delete
* @return string|bool
[325] Fix | Delete
*/
[326] Fix | Delete
function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key)
[327] Fix | Delete
{
[328] Fix | Delete
try {
[329] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key, true);
[330] Fix | Delete
} catch (Error $ex) {
[331] Fix | Delete
return false;
[332] Fix | Delete
} catch (Exception $ex) {
[333] Fix | Delete
return false;
[334] Fix | Delete
}
[335] Fix | Delete
}
[336] Fix | Delete
}
[337] Fix | Delete
if (!is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_encrypt')) {
[338] Fix | Delete
/**
[339] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt()
[340] Fix | Delete
* @param string $message
[341] Fix | Delete
* @param string $assocData
[342] Fix | Delete
* @param string $nonce
[343] Fix | Delete
* @param string $key
[344] Fix | Delete
* @return string
[345] Fix | Delete
* @throws SodiumException
[346] Fix | Delete
* @throws TypeError
[347] Fix | Delete
*/
[348] Fix | Delete
function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key)
[349] Fix | Delete
{
[350] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key, true);
[351] Fix | Delete
}
[352] Fix | Delete
}
[353] Fix | Delete
if (!is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_keygen')) {
[354] Fix | Delete
/**
[355] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_keygen()
[356] Fix | Delete
* @return string
[357] Fix | Delete
* @throws Exception
[358] Fix | Delete
*/
[359] Fix | Delete
function sodium_crypto_aead_xchacha20poly1305_ietf_keygen()
[360] Fix | Delete
{
[361] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_keygen();
[362] Fix | Delete
}
[363] Fix | Delete
}
[364] Fix | Delete
if (!is_callable('sodium_crypto_auth')) {
[365] Fix | Delete
/**
[366] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_auth()
[367] Fix | Delete
* @param string $message
[368] Fix | Delete
* @param string $key
[369] Fix | Delete
* @return string
[370] Fix | Delete
* @throws SodiumException
[371] Fix | Delete
* @throws TypeError
[372] Fix | Delete
*/
[373] Fix | Delete
function sodium_crypto_auth($message, $key)
[374] Fix | Delete
{
[375] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_auth($message, $key);
[376] Fix | Delete
}
[377] Fix | Delete
}
[378] Fix | Delete
if (!is_callable('sodium_crypto_auth_keygen')) {
[379] Fix | Delete
/**
[380] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_auth_keygen()
[381] Fix | Delete
* @return string
[382] Fix | Delete
* @throws Exception
[383] Fix | Delete
*/
[384] Fix | Delete
function sodium_crypto_auth_keygen()
[385] Fix | Delete
{
[386] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_auth_keygen();
[387] Fix | Delete
}
[388] Fix | Delete
}
[389] Fix | Delete
if (!is_callable('sodium_crypto_auth_verify')) {
[390] Fix | Delete
/**
[391] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_auth_verify()
[392] Fix | Delete
* @param string $mac
[393] Fix | Delete
* @param string $message
[394] Fix | Delete
* @param string $key
[395] Fix | Delete
* @return bool
[396] Fix | Delete
* @throws SodiumException
[397] Fix | Delete
* @throws TypeError
[398] Fix | Delete
*/
[399] Fix | Delete
function sodium_crypto_auth_verify($mac, $message, $key)
[400] Fix | Delete
{
[401] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_auth_verify($mac, $message, $key);
[402] Fix | Delete
}
[403] Fix | Delete
}
[404] Fix | Delete
if (!is_callable('sodium_crypto_box')) {
[405] Fix | Delete
/**
[406] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_box()
[407] Fix | Delete
* @param string $message
[408] Fix | Delete
* @param string $nonce
[409] Fix | Delete
* @param string $kp
[410] Fix | Delete
* @return string
[411] Fix | Delete
* @throws SodiumException
[412] Fix | Delete
* @throws TypeError
[413] Fix | Delete
*/
[414] Fix | Delete
function sodium_crypto_box($message, $nonce, $kp)
[415] Fix | Delete
{
[416] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_box($message, $nonce, $kp);
[417] Fix | Delete
}
[418] Fix | Delete
}
[419] Fix | Delete
if (!is_callable('sodium_crypto_box_keypair')) {
[420] Fix | Delete
/**
[421] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_box_keypair()
[422] Fix | Delete
* @return string
[423] Fix | Delete
* @throws SodiumException
[424] Fix | Delete
* @throws TypeError
[425] Fix | Delete
*/
[426] Fix | Delete
function sodium_crypto_box_keypair()
[427] Fix | Delete
{
[428] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_box_keypair();
[429] Fix | Delete
}
[430] Fix | Delete
}
[431] Fix | Delete
if (!is_callable('sodium_crypto_box_keypair_from_secretkey_and_publickey')) {
[432] Fix | Delete
/**
[433] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey()
[434] Fix | Delete
* @param string $sk
[435] Fix | Delete
* @param string $pk
[436] Fix | Delete
* @return string
[437] Fix | Delete
* @throws SodiumException
[438] Fix | Delete
* @throws TypeError
[439] Fix | Delete
*/
[440] Fix | Delete
function sodium_crypto_box_keypair_from_secretkey_and_publickey($sk, $pk)
[441] Fix | Delete
{
[442] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey($sk, $pk);
[443] Fix | Delete
}
[444] Fix | Delete
}
[445] Fix | Delete
if (!is_callable('sodium_crypto_box_open')) {
[446] Fix | Delete
/**
[447] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_box_open()
[448] Fix | Delete
* @param string $message
[449] Fix | Delete
* @param string $nonce
[450] Fix | Delete
* @param string $kp
[451] Fix | Delete
* @return string|bool
[452] Fix | Delete
*/
[453] Fix | Delete
function sodium_crypto_box_open($message, $nonce, $kp)
[454] Fix | Delete
{
[455] Fix | Delete
try {
[456] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_box_open($message, $nonce, $kp);
[457] Fix | Delete
} catch (Error $ex) {
[458] Fix | Delete
return false;
[459] Fix | Delete
} catch (Exception $ex) {
[460] Fix | Delete
return false;
[461] Fix | Delete
}
[462] Fix | Delete
}
[463] Fix | Delete
}
[464] Fix | Delete
if (!is_callable('sodium_crypto_box_publickey')) {
[465] Fix | Delete
/**
[466] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_box_publickey()
[467] Fix | Delete
* @param string $keypair
[468] Fix | Delete
* @return string
[469] Fix | Delete
* @throws SodiumException
[470] Fix | Delete
* @throws TypeError
[471] Fix | Delete
*/
[472] Fix | Delete
function sodium_crypto_box_publickey($keypair)
[473] Fix | Delete
{
[474] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_box_publickey($keypair);
[475] Fix | Delete
}
[476] Fix | Delete
}
[477] Fix | Delete
if (!is_callable('sodium_crypto_box_publickey_from_secretkey')) {
[478] Fix | Delete
/**
[479] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey()
[480] Fix | Delete
* @param string $sk
[481] Fix | Delete
* @return string
[482] Fix | Delete
* @throws SodiumException
[483] Fix | Delete
* @throws TypeError
[484] Fix | Delete
*/
[485] Fix | Delete
function sodium_crypto_box_publickey_from_secretkey($sk)
[486] Fix | Delete
{
[487] Fix | Delete
return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey($sk);
[488] Fix | Delete
}
[489] Fix | Delete
}
[490] Fix | Delete
if (!is_callable('sodium_crypto_box_seal')) {
[491] Fix | Delete
/**
[492] Fix | Delete
* @see ParagonIE_Sodium_Compat::crypto_box_seal()
[493] Fix | Delete
* @param string $message
[494] Fix | Delete
* @param string $publicKey
[495] Fix | Delete
* @return string
[496] Fix | Delete
* @throws SodiumException
[497] Fix | Delete
* @throws TypeError
[498] Fix | Delete
*/
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function