PATH:
opt
/
alt
/
tests
/
alt-php71-pecl-libsodium_2.0.23-1.el8
/
tests
--TEST-- Check for libsodium secretbox --SKIPIF-- <?php if (!extension_loaded("sodium")) print "skip"; ?> --FILE-- <?php $nonce = random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); $key = sodium_crypto_secretbox_keygen(); $a = sodium_crypto_secretbox('test', $nonce, $key); $x = sodium_crypto_secretbox_open($a, $nonce, $key); var_dump(sodium_bin2hex($x)); $y = sodium_crypto_secretbox_open("\0" . $a, $nonce, $key); var_dump($y); try { sodium_crypto_secretbox('test', substr($nonce, 1), $key); } catch (SodiumException $ex) { var_dump(true); } ?> --EXPECT-- string(8) "74657374" bool(false) bool(true)
[-] crypto_hex.phpt
[edit]
[-] crypto_generichash.phpt
[edit]
[-] crypto_auth.phpt
[edit]
[-] crypto_secretstream.phpt
[edit]
[-] crypto_secretbox.phpt
[edit]
[-] pwhash_argon2i.phpt
[edit]
[-] crypto_aead.phpt
[edit]
[-] crypto_kx.phpt
[edit]
[-] crypto_box.phpt
[edit]
[-] crypto_scalarmult.phpt
[edit]
[-] installed.phpt
[edit]
[-] exception_trace_without_args.phpt
[edit]
[-] crypto_kdf.phpt
[edit]
[-] crypto_sign.phpt
[edit]
[+]
..
[-] version.phpt
[edit]
[-] inc_add.phpt
[edit]
[-] crypto_stream.phpt
[edit]
[-] crypto_shorthash.phpt
[edit]
[-] utils.phpt
[edit]