murmurhash3.phpt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. Hash: MurmurHash3 test
  3. --FILE--
  4. <?php
  5. $h = hash("murmur3a", "foo");
  6. echo $h, "\n";
  7. $h = hash("murmur3c", "Two hashes meet in a bar", false);
  8. echo $h, "\n";
  9. $h = hash("murmur3c", "hash me!");
  10. echo $h, "\n";
  11. $h = hash("murmur3f", "Two hashes meet in a bar", false);
  12. echo $h, "\n";
  13. $h = hash("murmur3f", "hash me!");
  14. echo $h, "\n";
  15. $ctx = hash_init("murmur3a");
  16. hash_update($ctx, "hello");
  17. hash_update($ctx, " there");
  18. $h0 = hash_final($ctx);
  19. $h1 = hash("murmur3a", "hello there");
  20. echo $h0, " ", $h1, "\n";
  21. $ctx = hash_init("murmur3c");
  22. hash_update($ctx, "hello");
  23. hash_update($ctx, " there");
  24. $h0 = hash_final($ctx);
  25. $h1 = hash("murmur3c", "hello there");
  26. echo $h0, " ", $h1, "\n";
  27. $ctx = hash_init("murmur3f");
  28. hash_update($ctx, "hello");
  29. hash_update($ctx, " there");
  30. $h0 = hash_final($ctx);
  31. $h1 = hash("murmur3f", "hello there");
  32. echo $h0, " ", $h1, "\n";
  33. ?>
  34. --EXPECT--
  35. f6a5c420
  36. 8036c2707453c6f37348142be7eaf75c
  37. c7009299985a5627a9280372a9280372
  38. 40256ed26fa6ece7785092ed33c8b659
  39. c43668294e89db0ba5772846e5804467
  40. 6440964d 6440964d
  41. 2bcadca212d62deb69712a721e593089 2bcadca212d62deb69712a721e593089
  42. 81514cc240f57a165c95eb63f9c0eedf 81514cc240f57a165c95eb63f9c0eedf