PATH:
opt
/
alt
/
tests
/
alt-php54-pecl-libsodium_1.0.6-1.el8
/
tests
--TEST-- Check for libsodium stream --SKIPIF-- <?php if (!extension_loaded("libsodium")) print "skip"; ?> --FILE-- <?php $nonce = \Sodium\randombytes_buf(\Sodium\CRYPTO_STREAM_NONCEBYTES); $key = \Sodium\randombytes_buf(\Sodium\CRYPTO_STREAM_KEYBYTES); $len = 100; $stream = \Sodium\crypto_stream($len, $nonce, $key); var_dump(strlen($stream)); $stream2 = \Sodium\crypto_stream($len, $nonce, $key); $nonce = \Sodium\randombytes_buf(\Sodium\CRYPTO_STREAM_NONCEBYTES); $stream3 = \Sodium\crypto_stream($len, $nonce, $key); $key = \Sodium\randombytes_buf(\Sodium\CRYPTO_STREAM_KEYBYTES); $stream4 = \Sodium\crypto_stream($len, $nonce, $key); var_dump($stream === $stream2); var_dump($stream !== $stream3); var_dump($stream !== $stream4); var_dump($stream2 !== $stream3); var_dump($stream2 !== $stream4); var_dump($stream3 !== $stream4); $stream5 = \Sodium\crypto_stream_xor($stream, $nonce, $key); var_dump($stream5 !== $stream); $stream6 = \Sodium\crypto_stream_xor($stream5, $nonce, $key); var_dump($stream6 === $stream); ?> --EXPECT-- int(100) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true)
[-] crypto_hex.phpt
[edit]
[-] pwhash_scrypt.phpt
[edit]
[-] crypto_generichash.phpt
[edit]
[-] crypto_auth.phpt
[edit]
[-] randombytes.phpt
[edit]
[-] crypto_secretbox.phpt
[edit]
[-] crypto_aead.phpt
[edit]
[-] crypto_kx.phpt
[edit]
[-] crypto_box.phpt
[edit]
[-] crypto_scalarmult.phpt
[edit]
[-] installed.phpt
[edit]
[-] crypto_sign.phpt
[edit]
[+]
..
[-] version.phpt
[edit]
[-] crypto_stream.phpt
[edit]
[-] crypto_shorthash.phpt
[edit]
[-] utils.phpt
[edit]