bug72362.phpt 756 B

12345678910111213141516171819202122232425262728293031323334
  1. --TEST--
  2. Bug #72362: OpenSSL Blowfish encryption is incorrect for short keys
  3. --EXTENSIONS--
  4. openssl
  5. --SKIPIF--
  6. <?php
  7. if (!in_array('bf-ecb', openssl_get_cipher_methods())) die('skip bf-ecb not available');
  8. ?>
  9. --FILE--
  10. <?php
  11. var_dump(
  12. bin2hex(
  13. openssl_encrypt(
  14. "this is a test string",
  15. "bf-ecb",
  16. "12345678",
  17. OPENSSL_RAW_DATA | OPENSSL_DONT_ZERO_PAD_KEY
  18. )
  19. )
  20. );
  21. var_dump(
  22. bin2hex(
  23. openssl_encrypt(
  24. "this is a test string",
  25. "bf-ecb",
  26. "1234567812345678",
  27. OPENSSL_RAW_DATA
  28. )
  29. )
  30. );
  31. ?>
  32. --EXPECT--
  33. string(48) "e3214d1b16e574828c8a3e222202dde81afd1ad2cb165ab3"
  34. string(48) "e3214d1b16e574828c8a3e222202dde81afd1ad2cb165ab3"