1--TEST-- 2Check for libsodium shorthash 3--SKIPIF-- 4<?php if (!extension_loaded("sodium")) print "skip"; ?> 5--FILE-- 6<?php 7$m1 = 'message'; 8$k1 = '0123456789ABCDEF'; 9$h1 = sodium_crypto_shorthash($m1, $k1); 10echo bin2hex($h1) . "\n"; 11$k2 = '0123456789abcdef'; 12$h2 = sodium_crypto_shorthash($m1, $k2); 13echo bin2hex($h2) . "\n"; 14$m2 = 'msg'; 15$h3 = sodium_crypto_shorthash($m2, $k2); 16echo bin2hex($h3) . "\n"; 17 18try { 19 sodium_crypto_shorthash($m1, $k1 . $k2); 20} catch (SodiumException $ex) { 21 var_dump(true); 22} 23?> 24--EXPECT-- 25e0ad6fdbf8b9a191 26c667b37af201a2d9 27d27fa3fc70b45b72 28bool(true) 29