PATH:
opt
/
alt
/
tests
/
alt-php54-pecl-libsodium_1.0.6-1.el8
/
tests
--TEST-- Check for libsodium randombytes --SKIPIF-- <?php if (!extension_loaded("libsodium")) print "skip"; ?> --FILE-- <?php $a = \Sodium\randombytes_buf(0); echo strlen($a); echo "\n"; $a = \Sodium\randombytes_buf(100); echo strlen($a); echo "\n"; $b = \Sodium\randombytes_buf(100); echo strlen($a); echo "\n"; if ($a === $b) { echo "Fail\n"; } else { echo "OK\n"; } $x = 10; $c = \Sodium\randombytes_random16(); while (\Sodium\randombytes_random16() === $c) { if (--$x <= 0) { die("FAIL\n"); } } echo "OK\n"; $x = 10000; do { $c = \Sodium\randombytes_random16(); if ($c < 0 || $c > 0xffff) { die("FAIL\n"); } } while (--$x > 0); echo "OK\n"; $d = \Sodium\randombytes_uniform(10); if ($d < 10) { echo "OK\n"; } ?> --EXPECT-- 0 100 100 OK OK OK OK
[-] 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]